public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }
public boolean add(String value) { int length = this.values.length; int index = (value.hashCode() & 0x7FFFFFFF) % length; String current; while ((current = this.values[index]) != null) { if (value.equals(current)) return false; // did not add it since it already existed if (++index == length) index = 0; } this.values[index] = value; // assumes the threshold is never equal to the size of the table if (++this.elementSize > this.threshold) rehash(); return true; }