On Jul 13, 2017, at 10:29 AM, Maurizio Cimadamore <maurizio.cimadam...@oracle.com> wrote: > > Maybe automatic refactoring to Map.Entry ? With the new static method added > in 9, creating one is also very fluent (but I > know that Entry doesn't convey same meaning as Pair in method > signatures/fields)
The JavaFX Pair Paul is asking for has key and value components, just like an Entry. Sounds like "Map.entry" should be in the running as a good-enough replacement for "new Pair". One problem with "just give me (x,y)" is that there are too many ways to express a pair of values in an O-O language, and even more after adding primitives and mutability. (Pure functional languages with complete polymorphism have an easier time.) The bug report JDK-4947273 very frankly offers five alternative versions, thereby undermining the reporter's case for "a standard Pair class" (where a=1). It *may* be that the Amber project, after introduces some sort of simplified class for simple data structures, could help us gravitate toward a (yes, a=1) standard Pair class, that would be one of those simplified things. Maybe. It is much more likely that the Valhalla project, when that grows mature, will give us enough polymorphism and functional data structures to put us in the same place as languages like Haskell, where it will be economical to define a single Pair type. (I'm hoping for an arity-polymorphic Tuple type, but that would be a stretch goal.) — John