Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 254955
Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/p2/metadata/generator/ProductQuery.java (-1 / +1 lines)
Lines 41-47 Link Here
41
				IInstallableUnit existing = (IInstallableUnit) elements.get(iu.getId());
41
				IInstallableUnit existing = (IInstallableUnit) elements.get(iu.getId());
42
				if (existing.getVersion().compareTo(iu.getVersion()) >= 0)
42
				if (existing.getVersion().compareTo(iu.getVersion()) >= 0)
43
					return true;
43
					return true;
44
				getList().remove(existing);
44
				getCollection().remove(existing);
45
			}
45
			}
46
			elements.put(iu.getId(), iu);
46
			elements.put(iu.getId(), iu);
47
			return super.accept(object);
47
			return super.accept(object);
(-)src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementCollector.java (-3 / +3 lines)
Lines 132-146 Link Here
132
		ElementQueryDescriptor queryDescriptor = element.getQueryProvider().getQueryDescriptor(element);
132
		ElementQueryDescriptor queryDescriptor = element.getQueryProvider().getQueryDescriptor(element);
133
		Collector collector = queryDescriptor.queryable.query(queryDescriptor.query, queryDescriptor.collector, null);
133
		Collector collector = queryDescriptor.queryable.query(queryDescriptor.query, queryDescriptor.collector, null);
134
		if (!collector.isEmpty())
134
		if (!collector.isEmpty())
135
			getList().add(element);
135
			getCollection().add(element);
136
	}
136
	}
137
137
138
	private void removeNestedCategories() {
138
	private void removeNestedCategories() {
139
		CategoryElement[] categoryIUs = (CategoryElement[]) getList().toArray(new CategoryElement[getList().size()]);
139
		CategoryElement[] categoryIUs = (CategoryElement[]) getCollection().toArray(new CategoryElement[getCollection().size()]);
140
		// If any other element refers to a category element, remove it from the list
140
		// If any other element refers to a category element, remove it from the list
141
		for (int i = 0; i < categoryIUs.length; i++) {
141
		for (int i = 0; i < categoryIUs.length; i++) {
142
			if (referredIUs.contains(categoryIUs[i].getIU().getId())) {
142
			if (referredIUs.contains(categoryIUs[i].getIU().getId())) {
143
				getList().remove(categoryIUs[i]);
143
				getCollection().remove(categoryIUs[i]);
144
			}
144
			}
145
		}
145
		}
146
	}
146
	}
(-)src/org/eclipse/equinox/internal/p2/ui/query/LatestIUVersionCollector.java (-1 / +1 lines)
Lines 46-52 Link Here
46
		Object matchElement = uniqueIds.get(iu.getId());
46
		Object matchElement = uniqueIds.get(iu.getId());
47
		if (matchElement == null || iu.getVersion().compareTo(getIU(matchElement).getVersion()) > 0) {
47
		if (matchElement == null || iu.getVersion().compareTo(getIU(matchElement).getVersion()) > 0) {
48
			if (matchElement != null)
48
			if (matchElement != null)
49
				getList().remove(matchElement);
49
				getCollection().remove(matchElement);
50
			matchElement = makeDefaultElement(iu);
50
			matchElement = makeDefaultElement(iu);
51
			uniqueIds.put(iu.getId(), matchElement);
51
			uniqueIds.put(iu.getId(), matchElement);
52
			return super.accept(matchElement);
52
			return super.accept(matchElement);
(-)src/org/eclipse/equinox/internal/p2/director/app/LatestIUVersionCollector.java (-1 / +1 lines)
Lines 22-28 Link Here
22
		Object matchElement = uniqueIds.get(iu.getId());
22
		Object matchElement = uniqueIds.get(iu.getId());
23
		if (matchElement == null || iu.getVersion().compareTo(getIU(matchElement).getVersion()) > 0) {
23
		if (matchElement == null || iu.getVersion().compareTo(getIU(matchElement).getVersion()) > 0) {
24
			if (matchElement != null)
24
			if (matchElement != null)
25
				getList().remove(matchElement);
25
				getCollection().remove(matchElement);
26
26
27
			matchElement = makeDefaultElement(iu);
27
			matchElement = makeDefaultElement(iu);
28
			uniqueIds.put(iu.getId(), matchElement);
28
			uniqueIds.put(iu.getId(), matchElement);
(-)src/org/eclipse/equinox/internal/provisional/p2/query/Collector.java (-7 / +16 lines)
Lines 23-29 Link Here
23
 * to perform different processing on the objects passed to it.
23
 * to perform different processing on the objects passed to it.
24
 */
24
 */
25
public class Collector {
25
public class Collector {
26
	private ArrayList collected = null;
26
	private Set collected = null;
27
27
28
	/**
28
	/**
29
	 * Creates a new collector.
29
	 * Creates a new collector.
Lines 45-61 Link Here
45
	 * or <code>false</code> to indicate the traversal should stop.
45
	 * or <code>false</code> to indicate the traversal should stop.
46
	 */
46
	 */
47
	public boolean accept(Object object) {
47
	public boolean accept(Object object) {
48
		getList().add(object);
48
		getCollection().add(object);
49
		return true;
49
		return true;
50
	}
50
	}
51
51
52
	/**
52
	/**
53
	 * Returns the list that is being used to collect results.
53
	 * Returns the collection that is being used to collect results. Unlike {@toCollection},
54
	 * @return the list being used to collect results.
54
	 * this returns the actual modifiable collection that is being used to store results. The
55
	 * return value is only intended to be used within subclasses and should not be exposed
56
	 * outside of a collection class.
57
	 * 
58
	 * @return the collection being used to collect results.
55
	 */
59
	 */
56
	protected List getList() {
60
	protected Collection getCollection() {
57
		if (collected == null)
61
		if (collected == null)
58
			collected = new ArrayList();
62
			collected = new HashSet();
59
		return collected;
63
		return collected;
60
	}
64
	}
61
65
Lines 100-106 Link Here
100
		return result;
104
		return result;
101
	}
105
	}
102
106
107
	/**
108
	 * Returns the collected objects as an immutable collection.
109
	 * 
110
	 * @return An unmodifiable collection of the collected objects
111
	 */
103
	public Collection toCollection() {
112
	public Collection toCollection() {
104
		return collected == null ? Collections.EMPTY_LIST : Collections.unmodifiableList(collected);
113
		return collected == null ? Collections.EMPTY_SET : Collections.unmodifiableSet(collected);
105
	}
114
	}
106
}
115
}
(-)src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java (-6 lines)
Lines 43-54 Link Here
43
	private static final String NO_TIMESTAMP = "-1"; //$NON-NLS-1$
43
	private static final String NO_TIMESTAMP = "-1"; //$NON-NLS-1$
44
	private static final String PROP_FROM_DROPINS = "org.eclipse.equinox.p2.reconciler.dropins"; //$NON-NLS-1$
44
	private static final String PROP_FROM_DROPINS = "org.eclipse.equinox.p2.reconciler.dropins"; //$NON-NLS-1$
45
45
46
	public class ListCollector extends Collector {
47
		public List getList() {
48
			return super.getList();
49
		}
50
	}
51
52
	private static final String CACHE_EXTENSIONS = "org.eclipse.equinox.p2.cache.extensions"; //$NON-NLS-1$
46
	private static final String CACHE_EXTENSIONS = "org.eclipse.equinox.p2.cache.extensions"; //$NON-NLS-1$
53
	private static final String PIPE = "|"; //$NON-NLS-1$
47
	private static final String PIPE = "|"; //$NON-NLS-1$
54
	final IProfile profile;
48
	final IProfile profile;

Return to bug 254955