Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.9.0)

E52944-01


oracle.javatools.util
Class WeightedList<E>

java.lang.Object
  extended by oracle.javatools.util.WeightedList<E>

All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>
Direct Known Subclasses:
WeightedList

public class WeightedList<E>
extends java.lang.Object
implements java.util.Collection<E>

Like a list but stores elements in the order specified by the weight. For example if you add(a, .5) and add(b,.3) the iterator() will return b then a.


Constructor Summary
WeightedList()
           
WeightedList(int initialCapacity)
           

 

Method Summary
 boolean add(E e)
           
 void add(E e, double weight)
          Adds e after the last existing entry that has a weight equal or higher than weight.
 boolean addAll(java.util.Collection<? extends E> c)
           
 void addFirst(E e, double weight)
          Adds e before the first existing entry that has a weight equal or higher than weight.
 void addLast(E e, double weight)
          Adds e after the last existing entry that has a weight equal or higher than weight.
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
 E get(int index)
           
 int indexOf(java.lang.Object e)
           
 boolean isEmpty()
           
 java.util.Iterator<E> iterator()
           
 boolean remove(java.lang.Object object)
          Removes the first entry that is equal to object
 boolean remove(java.lang.Object object, double weight)
          Removes the first entry that is equal to object and has the specified weight.
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection c)
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Methods inherited from interface java.util.Collection
equals, hashCode

 

Constructor Detail

WeightedList

public WeightedList()

WeightedList

public WeightedList(int initialCapacity)

Method Detail

add

public void add(E e,
                double weight)
Adds e after the last existing entry that has a weight equal or higher than weight. This method is equivalent to addLast(E, double)
Parameters:
e - The entry to add
weight - The entry weight

addFirst

public void addFirst(E e,
                     double weight)
Adds e before the first existing entry that has a weight equal or higher than weight.
Parameters:
e - The entry to add
weight - The entry weight

addLast

public void addLast(E e,
                    double weight)
Adds e after the last existing entry that has a weight equal or higher than weight.
Parameters:
e - The entry to add
weight - The entry weight

remove

public boolean remove(java.lang.Object object)
Removes the first entry that is equal to object
Specified by:
remove in interface java.util.Collection<E>
Parameters:
object - the object to remove
Returns:
true it the collection was changed

remove

public boolean remove(java.lang.Object object,
                      double weight)
Removes the first entry that is equal to object and has the specified weight.
Parameters:
object - the object to remove
weight - the corresponding weight
Returns:
true it the collection was changed

iterator

public java.util.Iterator<E> iterator()
Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>

get

public E get(int index)

size

public int size()
Specified by:
size in interface java.util.Collection<E>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<E>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<E>

add

public boolean add(E e)
Specified by:
add in interface java.util.Collection<E>

indexOf

public int indexOf(java.lang.Object e)

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<E>

addAll

public boolean addAll(java.util.Collection<? extends E> c)
Specified by:
addAll in interface java.util.Collection<E>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<E>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<E>

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection<E>

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection<E>

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.9.0)

E52944-01


Copyright © 1997, 2015, Oracle. All rights reserved.