Advertisement
JeffGrigg

ArrayListSort

Apr 15th, 2018
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.33 KB | None | 0 0
  1. // Cat names from:  https://www.cuteness.com/popular-cat-names
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5.  
  6. public class ArrayListSort {
  7.     public static void main(String[] args) {
  8.         final ArrayList<String> catNames = new ArrayList<>(Arrays.asList("Bella", "Tigger", "Chloe", "Shadow", "Luna", "Oreo", "Oliver", "Kitty", "Lucy", "Molly", "Jasper", "Smokey", "Gizmo", "Simba", "Tiger", "Charlie", "Angel", "Jack", "Lily", "Peanut", "Toby", "Baby", "Loki", "Midnight", "Milo", "Princess", "Sophie", "Harley", "Max", "Missy", "Rocky", "Zoe", "CoCo", "Misty", "Nala", "Oscar", "Pepper", "Sasha", "Buddy", "Pumpkin", "Kiki", "mittens", "bailey", "Callie", "Lucky", "Patches", "Simon", "Garfield", "George", "Maggie", "Sammy", "Sebastian", "Boots", "Cali", "Felix", "Lilly", "Phoebe", "Sassy", "tucker", "bandit", "Dexter", "Fiona", "Jake", "Precious", "Romeo", "Snickers", "Socks", "Daisy", "Gracie", "Lola", "Sadie", "sox", "Casper", "Fluffy", "Marley", "minnie", "Sweetie", "Ziggy", "Belle", "Blackie", "Chester", "Frankie", "Ginger", "Muffin", "Murphy", "Rusty", "Scooter", "BatMan", "boo", "Cleo", "Izzy", "Jasmine", "MIMI", "SUGAR", "cupcake", "Dusty", "Leo", "Noodle", "Panda", "Peaches"));
  9.  
  10.         catNames.sort(null);
  11.  
  12.         for (final String catName : catNames) {
  13.             System.out.println(catName);
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement