约 50 个结果
在新选项卡中打开链接
  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. Using Pairs or 2-tuples in Java - Stack Overflow

    2010年4月20日 · 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 …

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

    2014年6月20日 · 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 …

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

    2021年5月27日 · 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 …

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

    2013年6月3日 · 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 …

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

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

  7. java - Generic pair class - Stack Overflow

    2011年5月18日 · 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 …

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

    2011年1月24日 · 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 …

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

    2008年10月1日 · 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 …

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

    2013年12月9日 · 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 …