dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Reviews Compare Notes Search Review guide CI runs pi/skill-library/java/java-sequenced-collections/examples/jep-431.md Raw
Source: https://openjdk.org/jeps/431
SequencedCollection<String> names = new ArrayList<>(List.of("Alice", "Bob", "Carol"));
String first = names.getFirst();
String last = names.getLast();
for (String name : names.reversed()) {
System.out.println(name);
}
SequencedMap<Integer, String> map = new LinkedHashMap<>();
map.put(1, "one");
map.put(2, "two");
map.putFirst(0, "zero");
Map.Entry<Integer, String> newest = map.lastEntry();
Markdown source File outline # [JEP 431](https://openjdk.org/jeps/431) examples
Source: https://openjdk.org/jeps/431
```java
SequencedCollection<String > names = new ArrayList<>(List.of("Alice", "Bob", "Carol"));
String first = names.getFirst();
String last = names.getLast();
for (String name : names.reversed()) {
System.out.println(name);
}
```
```java
SequencedMap<Integer, String> map = new LinkedHashMap<>();
map.put(1, "one");
map.put(2, "two");
map.putFirst(0, "zero");
Map.Entry<Integer, String> newest = map.lastEntry();
```