About 50 results
Open links in new tab
  1. A Java collection of value pairs? (tuples?) - Stack Overflow

    457 I like how Java has a Map where you can define the types of each entry in the map, for example <String, Integer>. What I'm looking for is a type of collection where each element in the collection is a …

  2. Does Java SE 8 have Pairs or Tuples? - Stack Overflow

    Jun 20, 2014 · UPDATE: This answer is in response to the original question, Does Java SE 8 have Pairs or Tuples? (And implicitly, if not, why not?) The OP has updated the question with a more complete …

  3. Best way to implement a Pair class in Java - Stack Overflow

    May 27, 2021 · I have written the following code for a Pair class in Java using Map.Entry. Does anyone have any recommendations for improving it? The most important criteria for me that the class …

  4. Using Pairs or 2-tuples in Java - Stack Overflow

    Apr 20, 2010 · 3) In your case, you seem to need a Pair (i.e. a tuple of well-defined length 2). This renders maerics's answer or one of the supplementary answers the most efficient since you can …

  5. Creating a list of pairs in java - Stack Overflow

    Jan 24, 2011 · List<Pair<Float,Short>> pairList = new ArrayList<Pair<Float,Short>>(); You can also always make a List s of List s, but it becomes difficult to enforce sizing (that you have only pairs) and …

  6. java - What is the use of Pair Class and why have the implemented here ...

    Jun 3, 2013 · The Pair class is just a structure with two fields, that doesn't have a special name (unlike Person). Pairs (and more generally, tuples) are often used in languages like Python when you don't …

  7. What is the equivalent of the C++ Pair<L,R> in Java?

    Oct 1, 2008 · In a thread on comp.lang.java.help, Hunter Gratzner gives some arguments against the presence of a Pair construct in Java. The main argument is that a class Pair doesn't convey any …

  8. java - Generic pair class - Stack Overflow

    May 18, 2011 · Just attempting this question I found in a past exam paper so that I can prepare for an upcoming Java examination. Provide a generic class Pair for representing pairs of things. The class …

  9. Didn't Java once have a Pair class? - Stack Overflow

    Mar 4, 2014 · Am I remembering incorrectly, or did Java, once upon a time, provide a Pair class as part of its API?

  10. java - Collect successive pairs from a stream - Stack Overflow

    Dec 9, 2013 · Stream<Pair> pairs = StreamEx.of(stream).pairMap(Pair::new); This functionality is implemented using custom spliterator. It has quite low overhead and can parallelize nicely. Of course …