Exemplo n.º 1
0
 public boolean containsKey(Bauernhof b) {
   BauernhofIterator it = new BauernhofIterator(this.keys);
   Bauernhof elem = null;
   while (it.hasNext()) {
     elem = it.getNext();
     if (elem.getName().equals(b.getName())) return true;
   }
   return false;
   // returns whether specific key is in map or not
 }
Exemplo n.º 2
0
 public String toString() {
   StringBuffer buf = new StringBuffer();
   BauernhofIterator it = new BauernhofIterator(this.keys);
   Bauernhof b = null;
   buf.append("Map enthaelt: \n");
   while (it.hasNext()) {
     b = it.getNext();
     buf.append("KEY: " + b.getName());
     buf.append('\n');
     buf.append("VALUES:\n" + b.getTraktorList().toString());
     buf.append('\n');
   }
   return buf.toString();
 }