Skip to content

Commit fc86061

Browse files
authored
修复程序输出typo (#648)
* Update 12-Collections.md 程序输出typo * Update 12-Collections.md 程序输出typo
1 parent c0cc402 commit fc86061

File tree

1 file changed

+42
-108
lines changed

1 file changed

+42
-108
lines changed

docs/book/12-Collections.md

+42-108
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ public class ApplesAndOrangesWithoutGenerics {
5757
/* Output:
5858
___[ Error Output ]___
5959
Exception in thread "main"
60-
java.lang.ClassCastException: Orange cannot be cast to
61-
Apple
62-
at ApplesAndOrangesWithoutGenerics.main(ApplesA
63-
ndOrangesWithoutGenerics.java:23)
60+
java.lang.ClassCastException: Orange cannot be cast to Apple
61+
at ApplesAndOrangesWithoutGenerics.main(ApplesAndOrangesWithoutGenerics.java:23)
6462
*/
6563
```
6664

@@ -178,7 +176,7 @@ public class SimpleCollection {
178176
}
179177
}
180178
/* Output:
181-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
179+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
182180
*/
183181
```
184182

@@ -553,14 +551,10 @@ public class CrossCollectionIteration {
553551
}
554552
}
555553
/* Output:
556-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
557-
7:Manx
558-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
559-
7:Manx
560-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
561-
7:Manx
562-
5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug
563-
0:Rat
554+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
555+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
556+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
557+
5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug 0:Rat
564558
*/
565559
```
566560

@@ -594,14 +588,10 @@ public class CrossCollectionIteration2 {
594588
}
595589
}
596590
/* Output:
597-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
598-
7:Manx
599-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
600-
7:Manx
601-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
602-
7:Manx
603-
5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug
604-
0:Rat
591+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
592+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
593+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
594+
5:Cymric 2:Cymric 7:Manx 1:Manx 3:Mutt 6:Pug 4:Pug 0:Rat
605595
*/
606596
```
607597

@@ -640,12 +630,10 @@ public class ListIteration {
640630
}
641631
}
642632
/* Output:
643-
Rat, 1, 0; Manx, 2, 1; Cymric, 3, 2; Mutt, 4, 3; Pug,
644-
5, 4; Cymric, 6, 5; Pug, 7, 6; Manx, 8, 7;
633+
Rat, 1, 0; Manx, 2, 1; Cymric, 3, 2; Mutt, 4, 3; Pug, 5, 4; Cymric, 6, 5; Pug, 7, 6; Manx, 8, 7;
645634
7 6 5 4 3 2 1 0
646635
[Rat, Manx, Cymric, Mutt, Pug, Cymric, Pug, Manx]
647-
[Rat, Manx, Cymric, Cymric, Rat, EgyptianMau, Hamster,
648-
EgyptianMau]
636+
[Rat, Manx, Cymric, Cymric, Rat, EgyptianMau, Hamster, EgyptianMau]
649637
*/
650638
```
651639

@@ -854,8 +842,7 @@ public class SetOfInteger {
854842
}
855843
}
856844
/* Output:
857-
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
858-
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
845+
[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]
859846
*/
860847
```
861848

@@ -952,8 +939,7 @@ set2 in set1: true
952939
set1: [A, B, C, D, E, F, G, I, J, K, L, M]
953940
set2 in set1: false
954941
set2 removed from set1: [A, B, C, D, E, F, G, M]
955-
'X Y Z' added to set1: [A, B, C, D, E, F, G, M, X, Y,
956-
Z]
942+
'X Y Z' added to set1: [A, B, C, D, E, F, G, M, X, Y, Z]
957943
*/
958944
```
959945

@@ -980,13 +966,7 @@ public class UniqueWords {
980966
}
981967
}
982968
/* Output:
983-
[A, B, C, Collections, D, E, F, G, H, HashSet, I, J, K,
984-
L, M, N, Output, Set, SetOperations, String, System, X,
985-
Y, Z, add, addAll, added, args, class, collections,
986-
contains, containsAll, false, from, import, in, java,
987-
main, new, out, println, public, remove, removeAll,
988-
removed, set1, set2, split, static, to, true, util,
989-
void]
969+
[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]
990970
*/
991971
```
992972

@@ -1013,12 +993,7 @@ public class UniqueWordsAlphabetic {
1013993
}
1014994
}
1015995
/* Output:
1016-
[A, add, addAll, added, args, B, C, class, collections,
1017-
contains, containsAll, D, E, F, false, from, G, H,
1018-
HashSet, I, import, in, J, java, K, L, M, main, N, new,
1019-
out, Output, println, public, remove, removeAll,
1020-
removed, Set, set1, set2, SetOperations, split, static,
1021-
String, System, to, true, util, void, X, Y, Z]
996+
[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]
1022997
*/
1023998
```
1024999

@@ -1051,9 +1026,7 @@ public class Statistics {
10511026
}
10521027
}
10531028
/* Output:
1054-
{0=481, 1=502, 2=489, 3=508, 4=481, 5=503, 6=519,
1055-
7=471, 8=468, 9=549, 10=513, 11=531, 12=521, 13=506,
1056-
14=477, 15=497, 16=533, 17=509, 18=478, 19=464}
1029+
{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}
10571030
*/
10581031
```
10591032

@@ -1315,21 +1288,14 @@ public class InterfaceVsIterator {
13151288
}
13161289
}
13171290
/* Output:
1318-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1319-
7:Manx
1320-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1321-
7:Manx
1322-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1323-
7:Manx
1324-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1325-
7:Manx
1326-
{Ralph=Rat, Eric=Manx, Robin=Cymric, Lacey=Mutt,
1327-
Britney=Pug, Sam=Cymric, Spot=Pug, Fluffy=Manx}
1291+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
1292+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
1293+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
1294+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
1295+
{Ralph=Rat, Eric=Manx, Robin=Cymric, Lacey=Mutt, Britney=Pug, Sam=Cymric, Spot=Pug, Fluffy=Manx}
13281296
[Ralph, Eric, Robin, Lacey, Britney, Sam, Spot, Fluffy]
1329-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1330-
7:Manx
1331-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1332-
7:Manx
1297+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
1298+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
13331299
*/
13341300
```
13351301

@@ -1372,10 +1338,8 @@ extends AbstractCollection<Pet> {
13721338
}
13731339
}
13741340
/* Output:
1375-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1376-
7:Manx
1377-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1378-
7:Manx
1341+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
1342+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
13791343
*/
13801344
```
13811345

@@ -1417,8 +1381,7 @@ public class NonCollectionSequence extends PetSequence {
14171381
}
14181382
}
14191383
/* Output:
1420-
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug
1421-
7:Manx
1384+
0:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug 7:Manx
14221385
*/
14231386
```
14241387

@@ -1729,64 +1692,35 @@ public class CollectionDifferences {
17291692
}
17301693
}
17311694
/* Output:
1732-
Collection: [add, addAll, clear, contains, containsAll,
1733-
equals, forEach, hashCode, isEmpty, iterator,
1734-
parallelStream, remove, removeAll, removeIf, retainAll,
1735-
size, spliterator, stream, toArray]
1695+
Collection: [add, addAll, clear, contains, containsAll, equals, forEach, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray]
17361696
Interfaces in Collection: [Iterable]
17371697
Set extends Collection, adds: []
17381698
Interfaces in Set: [Collection]
17391699
HashSet extends Set, adds: []
17401700
Interfaces in HashSet: [Set, Cloneable, Serializable]
17411701
LinkedHashSet extends HashSet, adds: []
1742-
Interfaces in LinkedHashSet: [Set, Cloneable,
1743-
Serializable]
1744-
TreeSet extends Set, adds: [headSet,
1745-
descendingIterator, descendingSet, pollLast, subSet,
1746-
floor, tailSet, ceiling, last, lower, comparator,
1747-
pollFirst, first, higher]
1748-
Interfaces in TreeSet: [NavigableSet, Cloneable,
1749-
Serializable]
1750-
List extends Collection, adds: [replaceAll, get,
1751-
indexOf, subList, set, sort, lastIndexOf, listIterator]
1702+
Interfaces in LinkedHashSet: [Set, Cloneable, Serializable]
1703+
TreeSet extends Set, adds: [headSet, descendingIterator, descendingSet, pollLast, subSet, floor, tailSet, ceiling, last, lower, comparator, pollFirst, first, higher]
1704+
Interfaces in TreeSet: [NavigableSet, Cloneable, Serializable]
1705+
List extends Collection, adds: [replaceAll, get, indexOf, subList, set, sort, lastIndexOf, listIterator]
17521706
Interfaces in List: [Collection]
1753-
ArrayList extends List, adds: [trimToSize,
1754-
ensureCapacity]
1755-
Interfaces in ArrayList: [List, RandomAccess,
1756-
Cloneable, Serializable]
1757-
LinkedList extends List, adds: [offerFirst, poll,
1758-
getLast, offer, getFirst, removeFirst, element,
1759-
removeLastOccurrence, peekFirst, peekLast, push,
1760-
pollFirst, removeFirstOccurrence, descendingIterator,
1761-
pollLast, removeLast, pop, addLast, peek, offerLast,
1762-
addFirst]
1763-
Interfaces in LinkedList: [List, Deque, Cloneable,
1764-
Serializable]
1765-
Queue extends Collection, adds: [poll, peek, offer,
1766-
element]
1707+
ArrayList extends List, adds: [trimToSize, ensureCapacity]
1708+
Interfaces in ArrayList: [List, RandomAccess, Cloneable, Serializable]
1709+
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]
1710+
Interfaces in LinkedList: [List, Deque, Cloneable, Serializable]
1711+
Queue extends Collection, adds: [poll, peek, offer, element]
17671712
Interfaces in Queue: [Collection]
17681713
PriorityQueue extends Queue, adds: [comparator]
17691714
Interfaces in PriorityQueue: [Serializable]
1770-
Map: [clear, compute, computeIfAbsent,
1771-
computeIfPresent, containsKey, containsValue, entrySet,
1772-
equals, forEach, get, getOrDefault, hashCode, isEmpty,
1773-
keySet, merge, put, putAll, putIfAbsent, remove,
1774-
replace, replaceAll, size, values]
1715+
Map: [clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, replace, replaceAll, size, values]
17751716
HashMap extends Map, adds: []
17761717
Interfaces in HashMap: [Map, Cloneable, Serializable]
17771718
LinkedHashMap extends HashMap, adds: []
17781719
Interfaces in LinkedHashMap: [Map]
1779-
SortedMap extends Map, adds: [lastKey, subMap,
1780-
comparator, firstKey, headMap, tailMap]
1720+
SortedMap extends Map, adds: [lastKey, subMap, comparator, firstKey, headMap, tailMap]
17811721
Interfaces in SortedMap: [Map]
1782-
TreeMap extends Map, adds: [descendingKeySet,
1783-
navigableKeySet, higherEntry, higherKey, floorKey,
1784-
subMap, ceilingKey, pollLastEntry, firstKey, lowerKey,
1785-
headMap, tailMap, lowerEntry, ceilingEntry,
1786-
descendingMap, pollFirstEntry, lastKey, firstEntry,
1787-
floorEntry, comparator, lastEntry]
1788-
Interfaces in TreeMap: [NavigableMap, Cloneable,
1789-
Serializable]
1722+
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]
1723+
Interfaces in TreeMap: [NavigableMap, Cloneable, Serializable]
17901724
*/
17911725
```
17921726

0 commit comments

Comments
 (0)