@Test public void testGetIndex() { Options options = new Options(); assertEquals(-1, options.getIndex(new Object())); options.add(Integer.valueOf(123), "text", true); options.add(Integer.valueOf(456), "text", true); assertEquals(0, options.getIndex(Integer.valueOf(123))); assertEquals(1, options.getIndex(Integer.valueOf(456))); }
protected int getIndex(Object value) { if (value instanceof OptionEntry) { int index = list.indexOf(value); if (index>=0) return index; value = ((OptionEntry) value).getValue(); } OptionEntry oe = getEntry(value); return (oe!=null ? list.indexOf(oe) : -1); }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { protected int getIndex(Object value) { if (value instanceof OptionEntry) { int index = list.indexOf(value); if (index>=0) return index; value = ((OptionEntry) value).getValue(); } OptionEntry oe = getEntry(value); return (oe!=null ? list.indexOf(oe) : -1); } }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { protected int getIndex(Object value) { if (value instanceof OptionEntry) { int index = list.indexOf(value); if (index>=0) return index; value = ((OptionEntry) value).getValue(); } OptionEntry oe = getEntry(value); return (oe!=null ? list.indexOf(oe) : -1); } Options();  Options(Options other);  Options(OptionEntry [] entries);  Options(Class<?> enumType); }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { protected int getIndex(Object value) { if (value instanceof OptionEntry) { int index = list.indexOf(value); if (index>=0) return index; value = ((OptionEntry) value).getValue(); } OptionEntry oe = getEntry(value); return (oe!=null ? list.indexOf(oe) : -1); } Options();  Options(Options other);  Options(OptionEntry [] entries);  Options(Class<?> enumType); @Override Options clone(); OptionEntry getEntry(Object value); String get(Object value); boolean isActive(Object value); Object getValueAt(int i); String getTextAt(int i); Set<Object> getValues(); void set(Object value, String text, boolean active, InsertPos pos); void set(Object value, String text, InsertPos pos); void set(Object value, String text); void add(Object value, String text, boolean active); @Override boolean add(OptionEntry option); @Override void clear(); @Override boolean contains(Object value); boolean containsNull(); boolean exists(Object value); @Override boolean isEmpty(); @Override Iterator<OptionEntry> iterator(); @Override boolean remove(Object value); @Override int size(); @Override Object[] toArray(); @Override String toString(); void addXml(Element element, long flags); }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { protected int getIndex(Object value) { if (value instanceof OptionEntry) { int index = list.indexOf(value); if (index>=0) return index; value = ((OptionEntry) value).getValue(); } OptionEntry oe = getEntry(value); return (oe!=null ? list.indexOf(oe) : -1); } Options();  Options(Options other);  Options(OptionEntry [] entries);  Options(Class<?> enumType); @Override Options clone(); OptionEntry getEntry(Object value); String get(Object value); boolean isActive(Object value); Object getValueAt(int i); String getTextAt(int i); Set<Object> getValues(); void set(Object value, String text, boolean active, InsertPos pos); void set(Object value, String text, InsertPos pos); void set(Object value, String text); void add(Object value, String text, boolean active); @Override boolean add(OptionEntry option); @Override void clear(); @Override boolean contains(Object value); boolean containsNull(); boolean exists(Object value); @Override boolean isEmpty(); @Override Iterator<OptionEntry> iterator(); @Override boolean remove(Object value); @Override int size(); @Override Object[] toArray(); @Override String toString(); void addXml(Element element, long flags);  }