// kotlin
val nums = listOf(1, 2, 3)// Java + Guava
ImmutableList<Integer> nums = ImmutableList.of(1, 2, 3);######P.S. Collections.unmodifiableList(..) is not really immutable.
// kotlin
val nums = mutableListOf(4, 5, 6)// Java
List<Integer> nums = Arrays.asList(1, 2, 3);
// Java + Guava
List<Integer> nums = Lists.newArrayList(4, 5, 6);// kotlin
val nums = emptyList()// Java
List<Integer> nums = Collections.emptyList();
// Java + Guava
ImmutableList<Integer> nums = ImmutableList.of();// kotlin
val nums = setOf(1, 2, 3)// Java + Guava
ImmutableSet<Integer> nums = ImmutableSet.of(1, 2, 3);######P.S. Collections.unmodifiableSet(..) is not really immutable.
// kotlin
val nums = mutableSetOf(4, 5, 6)// Java + Guava
Set<Integer> nums = Sets.newHashSet(4, 5, 6);// kotlin
val nums = emptySet()// Java
Set<Integer> nums = Collections.emptySet();
// Java + Guava
ImmutableSet<Integer> nums = ImmutableSet.of();// kotlin
val map = mapOf(1 to "a", 2 to "b", 3 to "c")// Java + Guava
ImmutableMap<Integer, String> map = ImmutableMap.of(1, "a", 2, "b", 3, "c");######P.S. Collections.unmodifiableMap(..) is not really immutable.
// kotlin
val map = mutableMapOf(4 to "d", 5 to "e", 6 to "f")// Java + Guava
ImmutableMap<Integer, String> map = ImmutableMap.of(1, "a", 2, "b", 3, "c");// kotlin
val map = emptyMap()// Java + Guava
ImmutableMap<Integer> map = ImmutableMap.of();