Posts by Jean-François Savard • 271 points
4 posts
-
3
votes2
answers357
viewsA: Java Generics: Unknown wildcards and T
First of all, T may very well be replaced by E or Z or TYPE. It is only the name given to the generic type parameter. Most often, the following letters chosen by convention : K for "Key, "example :…
-
4
votes3
answers1646
viewsA: Java Maps: take key from value
First, this line does not compile : Map<String,String> myMap = new Map<String,String>(); You cannot create an instance of an interface. In your case, it would be better to use an Hashmap…
-
4
votes1
answer986
viewsA: Stream -> findFirst vs findAny
findAny is just a "flexible" implementation of findFirst that allows better performance for parallel streams (by relaxing the requirement to return the first item)? Correct. The method findAny…
java-8answered Jean-François Savard 271 -
3
votes2
answers4523
viewsA: Inner Class in Java, when to use?
There is always an alternative to the inner class. In general, we use an internal class when you need to access non-public /methods attributes. The official documentation extract : Use a non-static…