package collection
Design Goals
OPAL's collection library is primarily designed with high performance in mind. I.e., all methods provided by the collection library are reasonably optimized. However, providing a very large number of methods is a non-goal. Overall, OPAL's collection library provides:
- collection classes that are manually specialized for primitive data-types.
- collection classes that are optimized for particularly small collections of values.
- collection classes that target special use cases such as using a collection as a workset/worklist.
- collection classes that offer special methods that minimize the number of steps when compared to general purpose methods.
Integration With Scala's Collection Library
Hence, OPAL's collection library complements Scala's default collection library and is not
intended to replace it. Integration with Scala's collection library is primarily provided
by means of iterators (OPAL's Iterator
s inherit from Scala's Iterator
s). Furthermore
the companion object of each of OPAL's collection classes generally provides factory methods
that facilitate the conversion from Scala collection classes to OPAL collection classes.
Status
The collection library is growing. Nevertheless, the existing classes are production ready.
- Source
- package.scala
- Alphabetic
- By Inheritance
- collection
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait BitSet extends AnyRef
Common interface of all BitSet based collections provided by OPAL.
- case class CompleteCollection[+S](s: S) extends QualifiedCollection[S] with Product with Serializable
- abstract class ForeachRefIterator[+T] extends AnyRef
Specialized variant of an internal iterator.
Specialized variant of an internal iterator. The only way to iterate over a foreach iterator is to use
foreach
. Compared to a classical iterator, iteration can be repeated and more efficient implementation strategies are easily possible.- Note
The type bound
T <: AnyRef
is expected to be ex-/implicitly enforced by subclasses.
- case class IncompleteCollection[+S](s: S) extends QualifiedCollection[S] with Product with Serializable
- trait IntCollectionWithStableOrdering[T <: IntSet[T]] extends AnyRef
Can be mixed in if the iteration order is always that same independent of the insertion order.
Can be mixed in if the iteration order is always that same independent of the insertion order. This is typically the case if the values are (pseudo-)sorted.
- abstract class IntIterator extends AbstractIterator[Int]
Iterator over a collection of primitive int valuea; basically overrides all inherited methods to avoid (un)boxing.
Iterator over a collection of primitive int valuea; basically overrides all inherited methods to avoid (un)boxing.
- Note
No guarantee is given what will happen if
next
is called afterhasNext
returns or would have returned false.
- trait IntSet[T <: IntSet[T]] extends AnyRef
A set of integer values.
- trait LongCollectionWithStableOrdering[T <: LongCollectionWithStableOrdering[T]] extends AnyRef
Can be mixed in if the iteration order is always that same independent of the insertion order.
Can be mixed in if the iteration order is always that same independent of the insertion order. This is typically the case if the values are (pseudo-)sorted.
- abstract class LongIterator extends AbstractIterator[Long]
Iterator over a collection of longs; basically all methods are overridden to avoid (un)boxing operations.
- trait LongSet extends AnyRef
A set of long values.
- sealed trait QualifiedCollection[+S] extends AnyRef
Identifies a collection as being (guaranteed) complete or as being potentially incomplete.
Identifies a collection as being (guaranteed) complete or as being potentially incomplete.
This class is typically used by analyses that derive some results and which are also able to do so of in cases incomplete information. But in latter cases the analyses may not be able to determine whether the derived information is complete or not. For example, imagine you are analyzing some library (but not the JDK). In this case the class hierarchy will be incomplete and every analysis using it may compute incomplete information.
- trait RefIndexedView[+T] extends AnyRef
Defines a view on some indexed data structure.
Defines a view on some indexed data structure.
- Note
The type bound
T <: AnyRef
has to be ex-/implicitly enforced by subclasses.
- sealed abstract class SetRelation extends AnyRef
Describes the relation between two sets.
- type SomeIntSet = IntSet[_]
- trait UID extends AnyRef
Identifies objects which have - in the scope where the objects are used - unique ids.
Identifies objects which have - in the scope where the objects are used - unique ids. I.e., this trait is implemented by objects that have – by construction - unique ids in a well-defined scope. The
UIDSet
is based on comparing uids. - trait UIDValue extends UID
Identifies objects which have a – potentially context dependent – unique id.
Identifies objects which have a – potentially context dependent – unique id. I.e., this trait is implemented by objects that have – by construction - unique ids in a well-defined scope.
- Note
Two objects that are not equal may still have the same id, if both objects are guaranteed to never be compared against each other.
Value Members
- def asScala[K, SubK, V](map: ConcurrentHashMap[K, ConcurrentHashMap[SubK, V]]): Map[K, Map[SubK, V]]
Converts a multi-map (a Map that contains Maps) based on
java.util.concurrent.ConcurrentHashMap
s into a corresponding multi-map based onscala.collection.immutable.HashMap
s.Converts a multi-map (a Map that contains Maps) based on
java.util.concurrent.ConcurrentHashMap
s into a corresponding multi-map based onscala.collection.immutable.HashMap
s. E.g.,val source : ConcurrentHashMap[SourceElement, CMap[ArrayType, Set[DType]]] =... val target : Map[SourceElement, Map[ArrayType, Set[DType]]] = asScala(source)
- def binarySearch[T, X >: T <: Comparable[X]](array: ArraySeq[T], key: X): Int
- def commonPrefix[T](l1: List[T], l2: List[T]): List[T]
Returns the common prefix of the given lists.
Returns the common prefix of the given lists. If l1 is a prefix of l2, then l1 is returned. If l2 is a prefix of l1, l2 is returned, otherwise a new list that contains the prefix is returned. Hence, if
l1===l2
then l1 is returned. - def insertedAt[T, X >: T <: AnyRef](array: ArraySeq[T], insertionPoint: Int, e: X): ArraySeq[X]
- object EqualSets extends SetRelation
- object ForeachRefIterator
- object IntIterator
- object LongIterator
- object LongSet
Defines convenience functions and data-structures used by OPAL's data-structures.
- object RefIndexedView
- object SingletonSet
Facilitates the matching of a Scala collection
Set
that contains a single value. - object StrictSubset extends SetRelation
- object StrictSuperset extends SetRelation
- object UID
Helper methods related to data structures that have unique ids.
- object UncomparableSets extends SetRelation