public class ManyToManyMap<L,R> extends Object
Constructor and Description |
---|
ManyToManyMap()
Creates map with default initial size and load factor.
|
ManyToManyMap(int initialCapacity)
Creates map with default load factor and specified initial size.
|
ManyToManyMap(int initialCapacity,
float loadFactor)
Creates map with specified initial size and load factor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(L left,
R right)
Adds a key value mapping in this map.
|
void |
clear()
Removes all mappings.
|
boolean |
containsLeft(L left)
Check if this map contains a key.
|
boolean |
containsRight(R right)
Check if this map contains a key.
|
boolean |
equals(Object obj) |
Set<L> |
getLeft(R right)
Gets the bidirectional mappings for this object.
|
Set<R> |
getRight(L left)
Gets the bidirectional mappings for this object.
|
int |
hashCode() |
boolean |
isEmpty()
Check if this map contains any mappings.
|
Iterator<L> |
leftIterator()
Returns an Iterator over every left hand mapping in this map.
|
int |
numberOfmappingsForLeft(L left)
Returns the number of keys mapped to a value.
|
int |
numberOfmappingsForRight(R right)
Returns the number of keys mapped to a value.
|
boolean |
remove(L left,
R right)
Removes a many to many mapping between two objects.
|
Set<R> |
removeAllMappingsForLeft(L left)
Remove all mappings for an object.
|
Set<L> |
removeAllMappingsForRight(R right)
Remove all mappings for an object.
|
Iterator<R> |
rightIterator()
Returns an Iterator over every rightt hand mapping in this map.
|
int |
size()
Returns the number of mapped values, left or right
|
String |
toString() |
public ManyToManyMap()
public ManyToManyMap(int initialCapacity)
initialCapacity
- public ManyToManyMap(int initialCapacity, float loadFactor)
HashMap
initialCapacity
- loadFactor
- public void add(L left, R right)
left
- right
- public boolean remove(L left, R right)
left
- left side of the mappingright
- right side of the mappingpublic Set<R> removeAllMappingsForLeft(L left)
left
- the left side of the many to many mappingpublic Set<L> removeAllMappingsForRight(R right)
right
- the right side of the many to many mappingpublic Set<R> getRight(L left)
left
- public Set<L> getLeft(R right)
right
- public int size()
public int numberOfmappingsForLeft(L left)
left
- public int numberOfmappingsForRight(R right)
right
- public boolean containsLeft(L left)
left
- a mapped objectpublic boolean containsRight(R right)
right
- a mapped objectpublic boolean isEmpty()
public void clear()
public Iterator<L> leftIterator()
public Iterator<R> rightIterator()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
Copyright © 2015. All rights reserved.