Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 849b41deadfd0e7bbe57a149b364e623f9816f6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*******************************************************************************
 *  Copyright (c) 2011 IBM Corporation and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 * 
 *  Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.p2.core;

/**
 * A Pool allows semantically equivalent objects to be shared.  To be useful, objects added to the pool should implement
 * a meaningful equals() method.
 * <p>
 * Care must be taken by users that object sharing is appropriate for their application.  It is easy
 * to "over share" objects leading to unexpected and difficult to debug behaviour.
 * </p><p>
 * This interface is not intended to be implemented by clients.
 * </p>
 * @noimplement This interface is not intended to be implemented by clients. 
 * @since 2.1
 */
public interface IPool<T> {

	/** 
	 * Returns the first object from this pool which is equal to the given object.  If the pool 
	 * contains no such object then the object is added to the pool and returned.  If the object is <code>null</code>, 
	 * <code>null</code> is returned.
	 * 
	 * @param newObject the object to add
	 * @return a shared object that is equal to the given object or <code>null</code>
	 */
	public abstract T add(T newObject);
}

Back to the top