Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.util
Interface BinaryLongMap

All Known Implementing Classes:
BinaryRadixTree, MultiBinaryLongMap.AbstractDelegateBinaryLongMap, MultiBinaryLongMap.DelegatingBinaryLongMap, MultiBinaryLongMap.LeftoverLongMapHolder.LeftoverMaskedBinaryLongMap, MultiBinaryLongMap.MaskedBinaryLongMap, MultiBinaryLongMap.PrimaryBinaryLongMap, MultiBinaryLongMap.PrimaryBinaryLongMap.CompressedPrimaryBinaryLongMap, MultiBinaryLongMap.PrimaryBinaryLongMap.DelegatingPrimaryBinaryLongMap, MultiBinaryLongMap.SafeBinaryLongMap, MultiBinaryLongMap.WrapperBinaryLongMap

public interface BinaryLongMap

A BinaryLongMap is an interface representing a mapping from Binary values to long values.

Since:
Coherence 12.1.2
Author:
cp 2012.08.03

Nested Class Summary
static interface BinaryLongMap.Entry
          Represents an Entry stored in a BinaryLongMap.
static interface BinaryLongMap.EntryVisitor
          Represent a visitor to be applied to one or more entries in the BinaryLongMap.
static class BinaryLongMap.SimpleMapImpl
          A java.util.Map<Binary, Long> implementation.

 

Method Summary
 void clear()
          Initialize the map to an empty state.
 long get(Binary binKey)
          Find the specified key in the map and return the value associated with it.
 void internKeys(java.lang.Object o)
          Internal opaque method: De-duplicate keys.
 java.util.Iterator keys()
          Obtain an iterator of the keys stored in the map.
 java.util.Iterator keys(com.oracle.common.base.Predicate predicate)
          Obtain an iterator of the keys stored in the map whose corresponding Entry matches the passed Predicate<Entry>.
 void put(Binary binKey, long lValue)
          Blindly store the passed value for the specified key, adding the key if it is not already in the map, or replacing the current value if the key is in the map.
 boolean putIfAbsent(Binary binKey, long lValue)
          Store the passed value for the specified key, only if the key does not currently exist in the map.
 void remove(Binary binKey)
          Blindly remove the specified Binary key from the map.
 boolean remove(Binary binKey, long lValue)
          Remove the specified Binary key from the map iff it exists in the map and is associated with the specified value.
 boolean replace(Binary binKey, long lValueOld, long lValueNew)
          Store the passed "new" value for the specified key, only if the current value associated with the specified key is the same as the specified "old" value.
 int size()
          Determine the size of the map.
 void visit(Binary binKey, BinaryLongMap.EntryVisitor visitor)
          Apply the specified visitor to the entry associated with the specified key, if the entry exists or may be added.
 void visitAll(BinaryLongMap.EntryVisitor visitor)
          Apply the specified visitor to all entries in the BinaryLongMap.

 

Method Detail

get

long get(Binary binKey)
Find the specified key in the map and return the value associated with it.
Parameters:
binKey - a Binary key
Returns:
the value associated with the specified key, or 0L if the specified key is not in the map

put

void put(Binary binKey,
         long lValue)
Blindly store the passed value for the specified key, adding the key if it is not already in the map, or replacing the current value if the key is in the map.

Note that associating the value zero with a key is analogous to removing the key.

Parameters:
binKey - the Binary key to add or update
lValue - the value to associate with the key

putIfAbsent

boolean putIfAbsent(Binary binKey,
                    long lValue)
Store the passed value for the specified key, only if the key does not currently exist in the map.

Note that associating the value zero with a key using this method will have no effect, since were that key already present, there would be no change, and were it not present, the value zero is analogous to removing the key, which again is no change (since it is not present).

Parameters:
binKey - a Binary key
lValue - the new value to associate with the passed key
Returns:
true iff the key was not present in the map, and now it is present in the map associated with the passed value

replace

boolean replace(Binary binKey,
                long lValueOld,
                long lValueNew)
Store the passed "new" value for the specified key, only if the current value associated with the specified key is the same as the specified "old" value.

Note that replacing the value of zero is analogous to putIfAbsent, and associating the value zero with a key using this method is the same as remove passing the old value to match.

Parameters:
binKey - a Binary key
lValueOld - the assumed old value to replace
lValueNew - the new value to associate with the passed key
Returns:
true iff the key was associated with the passed "old" value, and now it is associated with the passed "new" value

remove

void remove(Binary binKey)
Blindly remove the specified Binary key from the map.
Parameters:
binKey - a Binary key

remove

boolean remove(Binary binKey,
               long lValue)
Remove the specified Binary key from the map iff it exists in the map and is associated with the specified value.

Note that removing an association whose value is zero has no effect.

Parameters:
binKey - a Binary key
lValue - the value that the key must have in order to be removed
Returns:
true iff the map contained the key, it was associated with the specified value, and has now been removed

clear

void clear()
Initialize the map to an empty state.

size

int size()
Determine the size of the map.
Returns:
the number of unique keys stored in the map

keys

java.util.Iterator keys()
Obtain an iterator of the keys stored in the map.
Returns:
an Iterator of Binary keys

keys

java.util.Iterator keys(com.oracle.common.base.Predicate predicate)
Obtain an iterator of the keys stored in the map whose corresponding Entry matches the passed Predicate<Entry>.

The entry passed to the predicate should be treated as read-only, and any attempt to modify the entry may have undefined behavior and/or throw an Exception. Modifications to entries should instead be performed using an BinaryLongMap.EntryVisitor via the visit(com.tangosol.util.Binary, com.tangosol.util.BinaryLongMap.EntryVisitor) or visitAll(com.tangosol.util.BinaryLongMap.EntryVisitor) methods.

Parameters:
predicate - a Predicate<Entry> to apply to each Entry
Returns:
an Iterator of Binary keys

visit

void visit(Binary binKey,
           BinaryLongMap.EntryVisitor visitor)
Apply the specified visitor to the entry associated with the specified key, if the entry exists or may be added. The visited entry may or may not logically exist in the BinaryLongMap (e.g. it may be associated with a value of 0L) but is guaranteed to be safe to be added or removed (via BinaryLongMap.Entry.setValue(long)).
Parameters:
binKey - the key to visit
visitor - the visitor to apply

visitAll

void visitAll(BinaryLongMap.EntryVisitor visitor)
Apply the specified visitor to all entries in the BinaryLongMap.
Parameters:
visitor - the visitor to apply

internKeys

void internKeys(java.lang.Object o)
Internal opaque method: De-duplicate keys.
Parameters:
o - some implementation-specific object

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.