diff --git a/docs/book/12-Collections.md b/docs/book/12-Collections.md index e34688fa..a8198174 100644 --- a/docs/book/12-Collections.md +++ b/docs/book/12-Collections.md @@ -57,10 +57,8 @@ public class ApplesAndOrangesWithoutGenerics { /* Output: ___[ Error Output ]___ Exception in thread "main" -java.lang.ClassCastException: Orange cannot be cast to -Apple - at ApplesAndOrangesWithoutGenerics.main(ApplesA -ndOrangesWithoutGenerics.java:23) +java.lang.ClassCastException: Orange cannot be cast to Apple + at ApplesAndOrangesWithoutGenerics.main(ApplesAndOrangesWithoutGenerics.java:23) */ ``` @@ -178,7 +176,7 @@ public class SimpleCollection { } } /* Output: -0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, */ ``` @@ -553,14 +551,10 @@ public class CrossCollectionIteration { } } /* Output: -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug -0:Rat +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug 0:Rat */ ``` @@ -594,14 +588,10 @@ public class CrossCollectionIteration2 { } } /* Output: -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug -0:Rat +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug 0:Rat */ ``` @@ -640,12 +630,10 @@ public class ListIteration { } } /* Output: -Rat, 1, 0; Manx, 2, 1; Cymric, 3, 2; Mutt, 4, 3; Pug, -5, 4; Cymric, 6, 5; Pug, 7, 6; Manx, 8, 7; +Rat, 1, 0; Manx, 2, 1; Cymric, 3, 2; Mutt, 4, 3; Pug, 5, 4; Cymric, 6, 5; Pug, 7, 6; Manx, 8, 7; 7 6 5 4 3 2 1 0 [Rat, Manx, Cymric, Mutt, Pug, Cymric, Pug, Manx] -[Rat, Manx, Cymric, Cymric, Rat, EgyptianMau, Hamster, -EgyptianMau] +[Rat, Manx, Cymric, Cymric, Rat, EgyptianMau, Hamster, EgyptianMau] */ ``` @@ -854,8 +842,7 @@ public class SetOfInteger { } } /* Output: -[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] +[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] */ ``` @@ -952,8 +939,7 @@ set2 in set1: true set1: [A, B, C, D, E, F, G, I, J, K, L, M] set2 in set1: false set2 removed from set1: [A, B, C, D, E, F, G, M] -'X Y Z' added to set1: [A, B, C, D, E, F, G, M, X, Y, -Z] +'X Y Z' added to set1: [A, B, C, D, E, F, G, M, X, Y, Z] */ ``` @@ -980,13 +966,7 @@ public class UniqueWords { } } /* Output: -[A, B, C, Collections, D, E, F, G, H, HashSet, I, J, K, -L, M, N, Output, Set, SetOperations, String, System, X, -Y, Z, add, addAll, added, args, class, collections, -contains, containsAll, false, from, import, in, java, -main, new, out, println, public, remove, removeAll, -removed, set1, set2, split, static, to, true, util, -void] +[A, B, C, Collections, D, E, F, G, H, HashSet, I, J, K, L, M, N, Output, Set, SetOperations, String, System, X, Y, Z, add, addAll, added, args, class, collections, contains, containsAll, false, from, import, in, java, main, new, out, println, public, remove, removeAll, removed, set1, set2, split, static, to, true, util, void] */ ``` @@ -1013,12 +993,7 @@ public class UniqueWordsAlphabetic { } } /* Output: -[A, add, addAll, added, args, B, C, class, collections, -contains, containsAll, D, E, F, false, from, G, H, -HashSet, I, import, in, J, java, K, L, M, main, N, new, -out, Output, println, public, remove, removeAll, -removed, Set, set1, set2, SetOperations, split, static, -String, System, to, true, util, void, X, Y, Z] +[A, add, addAll, added, args, B, C, class, collections, contains, containsAll, D, E, F, false, from, G, H, HashSet, I, import, in, J, java, K, L, M, main, N, new, out, Output, println, public, remove, removeAll, removed, Set, set1, set2, SetOperations, split, static, String, System, to, true, util, void, X, Y, Z] */ ``` @@ -1051,9 +1026,7 @@ public class Statistics { } } /* Output: -{0=481, 1=502, 2=489, 3=508, 4=481, 5=503, 6=519, -7=471, 8=468, 9=549, 10=513, 11=531, 12=521, 13=506, -14=477, 15=497, 16=533, 17=509, 18=478, 19=464} +{0=481, 1=502, 2=489, 3=508, 4=481, 5=503, 6=519, 7=471, 8=468, 9=549, 10=513, 11=531, 12=521, 13=506, 14=477, 15=497, 16=533, 17=509, 18=478, 19=464} */ ``` @@ -1315,21 +1288,14 @@ public class InterfaceVsIterator { } } /* Output: -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -{Ralph=Rat, Eric=Manx, Robin=Cymric, Lacey=Mutt, -Britney=Pug, Sam=Cymric, Spot=Pug, Fluffy=Manx} +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +{Ralph=Rat, Eric=Manx, Robin=Cymric, Lacey=Mutt, Britney=Pug, Sam=Cymric, Spot=Pug, Fluffy=Manx} [Ralph, Eric, Robin, Lacey, Britney, Sam, Spot, Fluffy] -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx */ ``` @@ -1372,10 +1338,8 @@ extends AbstractCollection { } } /* Output: -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx */ ``` @@ -1417,8 +1381,7 @@ public class NonCollectionSequence extends PetSequence { } } /* Output: -0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug -7:Manx +0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx */ ``` @@ -1729,64 +1692,35 @@ public class CollectionDifferences { } } /* Output: -Collection: [add, addAll, clear, contains, containsAll, -equals, forEach, hashCode, isEmpty, iterator, -parallelStream, remove, removeAll, removeIf, retainAll, -size, spliterator, stream, toArray] +Collection: [add, addAll, clear, contains, containsAll, equals, forEach, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray] Interfaces in Collection: [Iterable] Set extends Collection, adds: [] Interfaces in Set: [Collection] HashSet extends Set, adds: [] Interfaces in HashSet: [Set, Cloneable, Serializable] LinkedHashSet extends HashSet, adds: [] -Interfaces in LinkedHashSet: [Set, Cloneable, -Serializable] -TreeSet extends Set, adds: [headSet, -descendingIterator, descendingSet, pollLast, subSet, -floor, tailSet, ceiling, last, lower, comparator, -pollFirst, first, higher] -Interfaces in TreeSet: [NavigableSet, Cloneable, -Serializable] -List extends Collection, adds: [replaceAll, get, -indexOf, subList, set, sort, lastIndexOf, listIterator] +Interfaces in LinkedHashSet: [Set, Cloneable, Serializable] +TreeSet extends Set, adds: [headSet, descendingIterator, descendingSet, pollLast, subSet, floor, tailSet, ceiling, last, lower, comparator, pollFirst, first, higher] +Interfaces in TreeSet: [NavigableSet, Cloneable, Serializable] +List extends Collection, adds: [replaceAll, get, indexOf, subList, set, sort, lastIndexOf, listIterator] Interfaces in List: [Collection] -ArrayList extends List, adds: [trimToSize, -ensureCapacity] -Interfaces in ArrayList: [List, RandomAccess, -Cloneable, Serializable] -LinkedList extends List, adds: [offerFirst, poll, -getLast, offer, getFirst, removeFirst, element, -removeLastOccurrence, peekFirst, peekLast, push, -pollFirst, removeFirstOccurrence, descendingIterator, -pollLast, removeLast, pop, addLast, peek, offerLast, -addFirst] -Interfaces in LinkedList: [List, Deque, Cloneable, -Serializable] -Queue extends Collection, adds: [poll, peek, offer, -element] +ArrayList extends List, adds: [trimToSize, ensureCapacity] +Interfaces in ArrayList: [List, RandomAccess, Cloneable, Serializable] +LinkedList extends List, adds: [offerFirst, poll, getLast, offer, getFirst, removeFirst, element, removeLastOccurrence, peekFirst, peekLast, push, pollFirst, removeFirstOccurrence, descendingIterator, pollLast, removeLast, pop, addLast, peek, offerLast, addFirst] +Interfaces in LinkedList: [List, Deque, Cloneable, Serializable] +Queue extends Collection, adds: [poll, peek, offer, element] Interfaces in Queue: [Collection] PriorityQueue extends Queue, adds: [comparator] Interfaces in PriorityQueue: [Serializable] -Map: [clear, compute, computeIfAbsent, -computeIfPresent, containsKey, containsValue, entrySet, -equals, forEach, get, getOrDefault, hashCode, isEmpty, -keySet, merge, put, putAll, putIfAbsent, remove, -replace, replaceAll, size, values] +Map: [clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, replace, replaceAll, size, values] HashMap extends Map, adds: [] Interfaces in HashMap: [Map, Cloneable, Serializable] LinkedHashMap extends HashMap, adds: [] Interfaces in LinkedHashMap: [Map] -SortedMap extends Map, adds: [lastKey, subMap, -comparator, firstKey, headMap, tailMap] +SortedMap extends Map, adds: [lastKey, subMap, comparator, firstKey, headMap, tailMap] Interfaces in SortedMap: [Map] -TreeMap extends Map, adds: [descendingKeySet, -navigableKeySet, higherEntry, higherKey, floorKey, -subMap, ceilingKey, pollLastEntry, firstKey, lowerKey, -headMap, tailMap, lowerEntry, ceilingEntry, -descendingMap, pollFirstEntry, lastKey, firstEntry, -floorEntry, comparator, lastEntry] -Interfaces in TreeMap: [NavigableMap, Cloneable, -Serializable] +TreeMap extends Map, adds: [descendingKeySet, navigableKeySet, higherEntry, higherKey, floorKey, subMap, ceilingKey, pollLastEntry, firstKey, lowerKey, headMap, tailMap, lowerEntry, ceilingEntry, descendingMap, pollFirstEntry, lastKey, firstEntry, floorEntry, comparator, lastEntry] +Interfaces in TreeMap: [NavigableMap, Cloneable, Serializable] */ ```