About 2,440,000 results
Open links in new tab
  1. How to make a new List in Java - Stack Overflow

    May 13, 2009 · List<String> list = new ArrayList<>(); This is how to create a LinkedList in java, If you need to do frequent insertion/deletion of elements on the list, you should use LinkedList …

  2. java - What is the difference between List.of and Arrays.asList ...

    Oct 5, 2017 · Java 9 introduced new factory methods for lists, List.of: List<String> strings = List.of ("first", "second"); What's the difference between the previous and the new option? That is, …

  3. loops - Ways to iterate over a list in Java - Stack Overflow

    Being somewhat new to the Java language I'm trying to familiarize myself with all the ways (or at least the non-pathological ones) that one might iterate through a list (or perhaps other collection...

  4. How do I join two lists in Java? - Stack Overflow

    Oct 10, 2008 · Avoid Apache Commons Collections. It’s not typesafe, there are no generics. Great if you use Java 1.4, but for Java 5 and above, I’d prefer Google Guava.

  5. How to initialize List<String> object in Java? - Stack Overflow

    Nov 15, 2012 · List is an Interface, you cannot instantiate an Interface, because interface is a convention, what methods should have your classes. In order to instantiate, you need some …

  6. Convert list to array in Java - Stack Overflow

    How can I convert a List to an Array in Java? Check the code below: ArrayList<Tienda> tiendas; List<Tienda> tiendasList; tiendas = new ArrayList<Tienda> (); Resources res = this.

  7. Java: convert List<String> to a join()d String - Stack Overflow

    Nov 18, 2009 · String.join With Java 8 you can do this without any third party library. If you want to join a Collection of Strings you can use the String.join () method:

  8. java - How to sort List of objects by some property - Stack Overflow

    here the list is sorted in the same manner as Collections.sort (), but the sorted items would be stored/collected in another list "sortedFruits". So, if we want to print the sorted items of the list, …

  9. Java Generics: List, List<Object>, List<?> - Stack Overflow

    Jan 29, 2009 · List<String> L = new ArrayList<String>(); You should read that as "L is a kind of List that deals with String objects". When you start dealing with Factory classes, it is critical to …

  10. collections - How can I turn a List of Lists into a List in Java 8 ...

    Aug 5, 2014 · If I have a List&lt;List&lt;Object&gt;&gt;, how can I turn that into a List&lt;Object&gt; that contains all the objects in the same iteration order by using the features of Java 8?