/ * - java.utils.Collections is a collection of tools for the collection operation. Part follows: - public static <T> Boolean the addAll (Collection <T> C, T ... Elements): add some elements to the collection. - public static void shuffle (<? > List list) out of order: disrupt the order of collection. * / Public class Demo01Collections { public static void main (String [] args) { the ArrayList <String> = new new List the ArrayList <> (); // add to the collection of a plurality of elements /*list.add("a "); List.add ( "B"); List.add ( "C"); List.add ( "D"); List.add ( "E"); * / // public static <T> Boolean the addAll (Collection < T> c, T ... elements) : add some elements to the collection. Collections. System.out.println (List); // [A, B, C, D, E] // public static void shuffle (List List <?>) Out of sequence: sequence set upset. Collections.shuffle (List); System.out.println (List); // [B, D, C, A, E], [B, D, C, A, E] } }
Adding elements to a plurality of collection
Guess you like
Origin blog.csdn.net/qq_42352666/article/details/104757575
Recommended
Ranking