Opens profile photo
Follow
Click to Follow java
Java
@java
The official page of the #1 programming language and development platform.
Austin, TXoracle.com/javaJoined March 2010

Java’s Tweets

The Java SE Subscription Enterprise Performance Pack is now available for download under the Java SE OTN License—making it easy to develop, test, prototype, and demonstrate your applications for free. Learn more: social.ora.cl/6013OXyID
Image
27
Preview Features have been essential to the delivery of #Java for the past 5 years, and #Java20 is no exception. Check out the latest episode of the Inside Java Podcast for an in-depth conversation about the importance of Preview Features. social.ora.cl/6010OHkg6
Image
2
66
How do you name unused variables? If even just having to make that choice annoys you (it's not just me, right?), read on for how #JavaNext will fix that and make pattern matching (how's that related?!) more maintainable in the process. 🧵
  • normal
    34.3%
  • single-letter
    14.8%
  • "unused" or similar
    37.9%
  • something weird (comment)
    13%
609 votesFinal results
28
31
Show this thread
Q: How do you get/add/remove the first/last entry of a list, deque, sorted set/map, or any other collection with encounter order? How do you iterate in reverse order? A (on #Java20): Inconveniently 😒 to not at all 🙅🏾‍♂️. A (on #Java21): Easy! 😁 Let me show you how! 🧵
The following Java source code:

// getting first/last element on...

// ... `List`:
var first = list.get(0); 😐
var last = list.get(list.size()-1); // 😬

// ... `LinkedHashSet`:
var first = set.iterator().next();
first = set.stream().findFirst();
var last = 🤷
The following Java source code:



// getting first/last element on...

// ... `List`:
var first = list.get(0); 😐
var last = list.get(list.size()-1); // 😬

// ... `LinkedHashSet`:
var first = set.iterator().next();
first = set.stream().findFirst();
var last = 🤷

// iterating in reverse order over ...

// ... `List`:
for (var it = list.listIterator(list.size());
		it.hasPrevious();) {
	var e = it.previous();
    // use `e`
}

// ... `Deque`:
for (var it = deque.descendingIterator();
		it.hasNext();) {
    var e = it.next();
    // use `e`
}

// ... `NavigableSet`:
for (var e : navSet.descendingSet()) {
	// use `e`
}
The following Java source code:

// streaming in reverse order over ...
// ... `List`: 🤷
// ... `Deque`: 🤷
// ... `NavigableSet`:
navSet.descendingSet().stream()
4
107
Show this thread
Happy #Java20 release day, everybody! Get the freshest JDK right here: jdk.java.net/20/ Let's have a quick look at how the preview features progressed this release (after we looked over all the small and not-so-small additions to 20 last week 👇🏾). 🧵
Quote Tweet
The list of big features #Java20 finalizes is rather short: . (That was it already. 🥱) All 20 improves is security, performance, tools, regex, Unicode, and all previews. Maybe worth a closer look after all? ("This thread should've been a blog post." nipafx.dev/java-20-guide/)
Show this thread
2
123
Show this thread