thufir

entries

Sep 2nd, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. package telnet;
  2.  
  3. import java.util.AbstractMap.SimpleEntry;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. import java.util.Map.Entry;
  7.  
  8. class Entries {
  9.  
  10.     List<Entry> entries;
  11.  
  12.     void set(List<Entry> stringEntries) {
  13.         entries = new ArrayList<>();
  14.         String key = null, stringVal = null;
  15.         int intVal = 0;
  16.         for (Entry e : stringEntries) {
  17.             stringVal = (String) e.getValue();
  18.             intVal = Integer.parseInt(stringVal);
  19.             Entry<String, Integer> entry = new SimpleEntry<>(key, intVal);
  20.             entries.add(e);
  21.         }
  22.         System.out.println("monitor entries to follow");
  23.         for (Entry e : entries) {
  24.             System.out.println(e.getKey() + e.getValue().toString());
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment