About 2,270,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 · @Sandy Chapman: List.of does return some ImmutableList type, its actual name is just a non-public implementation detail. If it was public and someone cast it to List again, …

  3. 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 …

  4. 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...

  5. 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 …

  6. How to search in a List of Java object - Stack Overflow

    Oct 30, 2012 · I have a List of object and the list is very big. The object is class Sample { String value1; String value2; String value3; String value4; String value5; } Now I have to searc...

  7. java - Create a List of primitive int? - Stack Overflow

    Aug 2, 2013 · Is there a way to create a list of primitive int or any primitives in java No you can't. You can only create List of reference types, like Integer, String, or your custom type. It seems I …

  8. java - Initialization of an ArrayList in one line - Stack Overflow

    Jun 17, 2009 · List<String> places2 = Collections.singletonList("Buenos Aires"); This would mean that places2 is immutable (trying to change it in any way will cause an …

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

    Nov 18, 2009 · 983 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:

  10. 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.