/** Changes all pairs in the lookup to new values. Converts collection of * instances to collection of pairs. * @param col the collection of (Item) objects * @param conv the convertor to use or null */ public final <T,R> void set(Collection<T> col, Convertor<T,R> conv) { ArrayList<Pair<?>> l = new ArrayList<Pair<?>>(col.size()); Iterator<T> it = col.iterator(); if (conv == null) { while (it.hasNext()) { l.add(new SimpleItem<T>(it.next())); } } else { while (it.hasNext()) { l.add(new ConvertingItem<T,R>(it.next(), conv)); } } setPairs(l); }
/** Changes all pairs in the lookup to new values. Converts collection of * instances to collection of pairs. * @param col the collection of (Item) objects * @param conv the convertor to use or null */ public final void set (Collection col, Convertor conv) { ArrayList l = new ArrayList(col.size()); Iterator it = col.iterator(); if (conv == null) { while (it.hasNext()) { l.add (new SimpleItem (it.next())); } } else { while (it.hasNext()) { l.add (new ConvertingItem (it.next(), conv)); } } setPairs (l); }
/** Changes all pairs in the lookup to new values. Converts collection of * instances to collection of pairs. * @param col the collection of (Item) objects * @param conv the convertor to use or null */ public final void set (Collection col, Convertor conv) { ArrayList l = new ArrayList(col.size()); Iterator it = col.iterator(); if (conv == null) { while (it.hasNext()) { l.add (new SimpleItem (it.next())); } } else { while (it.hasNext()) { l.add (new ConvertingItem (it.next(), conv)); } } setPairs (l); }
/** Changes all pairs in the lookup to new values. Converts collection of * instances to collection of pairs. * @param col the collection of (Item) objects * @param conv the convertor to use or null */ public final <T,R> void set(Collection<T> col, Convertor<T,R> conv) { ArrayList<Pair<?>> l = new ArrayList<Pair<?>>(col.size()); Iterator<T> it = col.iterator(); if (conv == null) { while (it.hasNext()) { l.add(new SimpleItem<T>(it.next())); } } else { while (it.hasNext()) { l.add(new ConvertingItem<T,R>(it.next(), conv)); } } setPairs(l); }
/** Changes all pairs in the lookup to new values. Converts collection of * instances to collection of pairs. * @param col the collection of (Item) objects * @param conv the convertor to use or null */ public final <T,R> void set(Collection<T> col, Convertor<T,R> conv) { ArrayList<Pair<?>> l = new ArrayList<Pair<?>>(col.size()); Iterator<T> it = col.iterator(); if (conv == null) { while (it.hasNext()) { l.add(new SimpleItem<T>(it.next())); } } else { while (it.hasNext()) { l.add(new ConvertingItem<T,R>(it.next(), conv)); } } setPairs(l); }
public void propertyChange(PropertyChangeEvent evt) { if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) { selectedNodes.setPairs(Collections.<AbstractLookup.Pair>emptyList()); for (Node n : (Node[]) evt.getNewValue()) { selectedNodes.add(n); if (n instanceof AbstractCsmNode) { CsmObject csmObject = ((AbstractCsmNode) n).getCsmObject(); if (csmObject != null) { selectedNodes.add(csmObject); } } } } }