| 程序包 | 说明 |
|---|---|
| cn.ponfee.commons.collect | |
| cn.ponfee.commons.serial | |
| cn.ponfee.commons.tree |
| 类和说明 |
|---|
| ArrayHashKey
The class use in Object array as hash map key
Use for HashMap key
|
| ByteArrayWrapper
The class use in byte array as hash map key
For HashMap key
|
| FilterableIterator
遍历集合,选取符合条件的元素,用于增强for循环场景
for (String s : FilterableIterator.of("", null, "a")) {
System.out.println(s);
}
|
| ImmutableArrayList
Representing immutable List
|
| ImmutableHashList
Immutable hash map & list structure
|
| StreamForker
The class use in fork
Stream,
from book "Java 8 In Action"
Usage:
Stream<Integer> stream = Stream.of(1, 2, 3, 4, 4, 5, 5);
StreamForker.Results results = new StreamForker<>(stream)
.fork(1, s -> s.max(Integer::compareTo)) // 直接聚合
.fork(2, s -> s.distinct().reduce(0, Integer::sum))
.getResults();
|
| StreamForker.Results |
| ValueSortedMap
Extends TreeMap sort by value:
ValueSortedMap valueSortedMap = ValueSortedMap.nullsFirst(a map);
Also use like this:
Map<String, Integer> originMap = ImmutableMap.of("b", 2, "a", 1);
TreeMap<String, Integer> sortedByValueMap = new TreeMap<>(Comparator.comparing(originMap::get));
sortedByValueMap.putAll(originMap);
|
| 类和说明 |
|---|
| ByteArrayTrait
Represents the class has an byte[] array args constructor and a toByteArray method
For serialize
|
| ByteArrayWrapper
The class use in byte array as hash map key
For HashMap key
|
| 类和说明 |
|---|
| ImmutableArrayList
Representing immutable List
|
Copyright © 2023. All rights reserved.