org.opencyc.util
Class OcCollectionUtils

java.lang.Object
  |
  +--org.opencyc.util.OcCollectionUtils

public class OcCollectionUtils
extends java.lang.Object

Provides Collection utilities not otherwise provided by Jakarta Commons. All methods are static. There is no need to instantiate this class.

Author:
Stephen L. Reed

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Constructor Summary
OcCollectionUtils()
           
 
Method Summary
static boolean hasDuplicates(java.util.Collection collection)
          Returns true iff the given Collection has any duplicated elements.
static boolean hasIntersection(java.util.Collection a, java.util.Collection b)
          Returns true iff the given Collections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OcCollectionUtils

public OcCollectionUtils()
Method Detail

hasIntersection

public static boolean hasIntersection(java.util.Collection a,
                                      java.util.Collection b)
Returns true iff the given Collections. have any elements in common. Performs HashSet search for larger collections.
Parameters:
a - the first collection considered for intersection
b - the second collection considered for intersection
Returns:
true if the given Collections. have any elements in common.

hasDuplicates

public static boolean hasDuplicates(java.util.Collection collection)
Returns true iff the given Collection has any duplicated elements.
Parameters:
collection - the collection under consideration for having duplicate elements
Returns:
true the given Collection has any duplicated elements