@Override public void insertAfter(E toInsert, E point) { if (toInsert == null) { throw new RuntimeException("Bad idea! You tried to insert " + " a null object into a Chain!"); } if (map.containsKey(toInsert)) { throw new RuntimeException("Chain already contains object."); } Link<E> temp = map.get(point); if (temp == null) { throw new RuntimeException("Insertion point not found in chain!"); } stateCount++; Link<E> newLink = temp.insertAfter(toInsert); map.put(toInsert, newLink); }
@Override public void addLast(E item) { if (item == null) { throw new RuntimeException("Bad idea! You tried to insert " + " a null object into a Chain!"); } stateCount++; Link<E> newLink, temp; if (map.containsKey(item)) { throw new RuntimeException("Chain already contains object: " + item); } if (lastItem != null) { temp = map.get(lastItem); newLink = temp.insertAfter(item); } else { newLink = new Link<E>(item); firstItem = lastItem = item; } map.put(item, newLink); }
public void insertAfter(E toInsert, E point) { if (toInsert == null) throw new RuntimeException("Bad idea! You tried to insert " + " a null object into a Chain!"); if(map.containsKey(toInsert)) throw new RuntimeException("Chain already contains object."); stateCount++; Link temp = map.get(point); Link newLink = temp.insertAfter(toInsert); map.put(toInsert, newLink); objectIndexes = null; // RoboVM note: Added }
public void addLast(E item) { if (item == null) throw new RuntimeException("Bad idea! You tried to insert " + " a null object into a Chain!"); stateCount++; Link newLink, temp; if(map.containsKey(item)) throw new RuntimeException("Chain already contains object: " + item); if(lastItem != null) { temp = map.get(lastItem); newLink = temp.insertAfter(item); } else { newLink = new Link(item); firstItem = lastItem = item; } map.put(item, newLink); objectIndexes = null; // RoboVM note: Added }
public void addLast(E item) { if (item == null) throw new RuntimeException("Bad idea! You tried to insert " + " a null object into a Chain!"); stateCount++; Link newLink, temp; if(map.containsKey(item)) throw new RuntimeException("Chain already contains object: " + item); if(lastItem != null) { temp = map.get(lastItem); newLink = temp.insertAfter(item); } else { newLink = new Link(item); firstItem = lastItem = item; } map.put(item, newLink); objectIndexes = null; // RoboVM note: Added }
public void insertAfter(E toInsert, E point) { if (toInsert == null) throw new RuntimeException("Bad idea! You tried to insert " + " a null object into a Chain!"); if(map.containsKey(toInsert)) throw new RuntimeException("Chain already contains object."); stateCount++; Link temp = map.get(point); Link newLink = temp.insertAfter(toInsert); map.put(toInsert, newLink); objectIndexes = null; // RoboVM note: Added }