Advertisement
Guest User

csupinakresurrection

a guest
Oct 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. package nekromancer;
  2.  
  3. import java.util.PriorityQueue;
  4.  
  5.  
  6. public class resurrection {
  7.    
  8.     public static void main(String[] args){
  9.        
  10.         String[] input = new String[] {"Aladar", "Cecilia", "Nekromanta", "Bela", "Nekromanta",
  11.                 "Nekromanta", "Denes", "Balazs", "Nekromanta", "Agnes"};       
  12.         PriorityQueue<String> teszt = new PriorityQueue<>();       
  13.         teszt = zombiesAreComing(input);
  14.         System.out.println(teszt);
  15.        
  16.     }
  17.    
  18.    
  19.     public static PriorityQueue<String> zombiesAreComing(String[] input)
  20.     {
  21.  
  22.         PriorityQueue<String> zombies = new PriorityQueue<>();
  23.         if (!(input[0].equals("Nekromanta")))
  24.         {
  25.         for (int i=1 ; i=input.length ; i++)
  26.             {
  27.  
  28.                 if (input[i].equals("Nekromanta")) zombies.add(input[i-1]);
  29.  
  30.             }
  31.         }
  32.  
  33.     return zombies;
  34.  
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement