Package com.keaplogik.examples.model.animals

Examples of com.keaplogik.examples.model.animals.Animal


         * Animals by their animal class. Order doesn't matter, but we want to
         * ensure that animals are grouped by their animal class property.
         */
        Arrays.sort(animals, new Comparator() {
            public int compare(Object t, Object t1) {
                Animal firstAnimal = (Animal) t;
                Animal secondAnimal = (Animal) t1;
                return firstAnimal.getAnimalClass().hashCode() -
                        secondAnimal.getAnimalClass().hashCode();
            }
        });

        for (Animal animal : animals) {
            System.out.println(animal.toString());
View Full Code Here

TOP

Related Classes of com.keaplogik.examples.model.animals.Animal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.