About 50 results
Open links in new tab
  1. Checking if a collection is empty in Java: which is the best method?

    The other advantage of using Apache commons-collections CollectionUtils.isEmpty (or CollectionUtils.isNotEmpty) is that your if condition has less branches, so it is easier to reach a …

  2. What is the difference between Collection and List in Java?

    Jul 23, 2010 · 3 Collection is the main interface of Java Collections hierarchy and List (Sequence) is one of the sub interfaces that defines an ordered collection.

  3. What is a java collection? - Stack Overflow

    27 Usually an instance of java.util.Collection (although java.util.Map is officially also a part of the collections framework) Although the Collection interface can be implemented directly, usually …

  4. Java Collections: which collection to use and when?

    May 12, 2014 · As we all know with Java comes the Collections API that provide us with numerous data structures that we can use. I was wondering if there is some …

  5. sorting - Sorted collection in Java - Stack Overflow

    Jan 6, 2009 · I'm a beginner in Java. Please suggest which collection(s) can/should be used for maintaining a sorted list in Java. I have tried Map and Set, but they weren't what I was looking …

  6. How to count the number of occurrences of an element in a List

    Feb 3, 2009 · 5 What you want is a Bag - which is like a set but also counts the number of occurances. Unfortunately the java Collections framework - great as they are dont have a Bag …

  7. java - Collections.sort with multiple fields - Stack Overflow

    I have a list of "Report" objects with three fields (All String type)- ReportKey StudentNumber School I have a sort code goes like- Collections.sort(reportList, new …

  8. collections - Easiest way to convert a List to a Set in Java - Stack ...

    The MutableSet interface extends java.util.Set whereas the MutableIntSet interface does not. You can also convert any Iterable to a Set using the Sets factory class. Set<Integer> set = …

  9. Java Immutable Collections - Stack Overflow

    From Java 1.6 Collection Framework documentation: Collections that do not support any modification operations (such as add, remove and clear) are referred to as unmodifiable. [...] …

  10. Java Hashmap: How to get key from value? - Stack Overflow

    Sep 6, 2009 · If you choose to use the Commons Collections library instead of the standard Java Collections framework, you can achieve this with ease. The BidiMap interface in the …