@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); }
@Override public void addFirst(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."); } if (firstItem != null) { temp = map.get(firstItem); newLink = temp.insertBefore(item); } else { newLink = new Link<E>(item); firstItem = lastItem = item; } map.put(item, newLink); }
public void addFirst(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."); if(firstItem != null) { temp = map.get(firstItem); newLink = temp.insertBefore(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 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 addFirst(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."); if(firstItem != null) { temp = map.get(firstItem); newLink = temp.insertBefore(item); } else { newLink = new Link(item); firstItem = lastItem = item; } map.put(item, newLink); objectIndexes = null; // RoboVM note: Added }