JAVA   44

AlderComparator

Guest on 11th May 2022 04:31:17 PM

  1. import java.util.*;
  2. import java.text.*;
  3. /**************************************************************************
  4. *UppgiftB - ITKP2
  5. *Alder Comparator klass som heter AlderComparator.java.
  6. *
  7. *@Java version "1.5.0_06"
  8. *@Author Véronique Rarchaert
  9. *@vero-rar@dsv.su.se
  10. **************************************************************************//
  11. public class AlderComparator implements Comparator<Djur> {
  12.         Collator co = Collator.getInstance();
  13.  
  14.         public AlderComparator() {
  15.                 co.setStrength(Collator.PRIMARY);
  16.         //AlderComparator.
  17.  
  18.  
  19.         public int compare(Djur d1, Djur d2) {
  20.                 if (d1.ålder() < d2.ålder())
  21.                 return -1;
  22.                 else if (d1.ålder() > d2.ålder())
  23.                 return 1;
  24.                 else
  25.                 return //compare
  26. p//Klassen AlderComparator.

Raw Paste


Login or Register to edit or fork this paste. It's free.