Package org.goplanit.utils.wrapper
Interface MapWrapper<K,V>
-
- Type Parameters:
K
- key typeV
- value type
- All Known Subinterfaces:
ConnectoidEdges
,Connectoids<T>
,ConnectoidSegments
,DirectedConnectoids
,DirectedEdges
,DirectedPaths
,DirectedVertices
,Edges
,EdgeSegments
,GraphEntities<E>
,Links
,LinkSegments
,LongMapWrapper<V>
,MacroscopicLinkSegments
,MacroscopicLinkSegmentTypes
,MacroscopicNetworkLayers
,ManagedGraphEntities<E>
,ManagedIdEntities<E>
,Modes
,Nodes
,OdZones
,RoutedModeServices
,RoutedServicesLayers
,RoutedTripDepartures
,RoutedTrips<T>
,RoutedTripsFrequency
,RoutedTripsSchedule
,ServiceLegs
,ServiceLegSegments
,ServiceNetworkLayers
,ServiceNodes
,TopologicalLayers<T>
,TransferZoneGroups
,TransferZones
,TransportLayers<T>
,UndirectedConnectoids
,UntypedDirectedGraphLayers<L>
,UntypedPhysicalNetworkLayers<L>
,Vertices
,Zones<Z>
- All Known Implementing Classes:
ConnectoidEdgesImpl
,ConnectoidSegmentsImpl
,ConnectoidsImpl
,Demands.TimePeriods
,Demands.TravelerTypes
,Demands.UserClasses
,DirectedConnectoidsImpl
,DirectedEdgesImpl
,DirectedPathsImpl
,DirectedVerticesImpl
,EdgeSegmentsImpl
,EdgesImpl
,GraphEntitiesImpl
,LinkSegmentsImpl
,LinksImpl
,LongMapWrapperImpl
,MacroscopicLinkSegmentsImpl
,MacroscopicLinkSegmentTypesImpl
,MacroscopicNetworkLayersImpl
,ManagedIdEntitiesImpl
,MapWrapperImpl
,ModesImpl
,NodesImpl
,OdZonesImpl
,ProjectDemands
,ProjectNetworks
,ProjectOdPathSets
,ProjectRoutedServices
,ProjectServiceNetworks
,ProjectZonings
,RoutedModeServicesImpl
,RoutedServicesLayersImpl
,RoutedTripDeparturesImpl
,RoutedTripsFrequencyImpl
,RoutedTripsImpl
,RoutedTripsScheduleImpl
,ServiceLegSegmentsImpl
,ServiceLegsImpl
,ServiceNetworkLayersImpl
,ServiceNodesImpl
,TopologicalLayersImpl
,TransferZoneGroupsImpl
,TransferZonesImpl
,TransportLayersImpl
,UndirectedConnectoidsImpl
,UntypedPhysicalNetworkLayersImpl
,VerticesImpl
,ZonesImpl
public interface MapWrapper<K,V> extends Iterable<V>, Cloneable
Wrap a map as a named class- Author:
- markr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
addAll(Iterable<? extends V> iterable)
add all elements of iterablevoid
clear()
Clear all entries from mapMapWrapper<K,V>
clone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly createdboolean
contains(V value)
Check if value is already presentV
findFirst(Predicate<V> valuePredicate)
Find first entry that matches the predicatedefault <T extends V>
voidforEachIn(Collection<T> values, Consumer<T> consumer)
apply provided consumer to each element in values as long as that element is registered on this wrapperV
get(K key)
Collect entry from containerdefault V
getFirst()
collect the first entry based on the iterator's result, which is not necessarily the fist entry ordered by the key, it is just the first entry the iterator would provideK
getKeyByValue(V value)
collect the key used for the given valueboolean
isEmpty()
Verify if the map is emptyV
register(V value)
Register on the internal containerV
remove(V value)
Remove value from mapint
size()
The number of registered entriesCollection<V>
toCollection()
Collect values as unmodifiable collectionSet<V>
valuesAsNewSet()
Create a copy of the map's distinct values as a set-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
register
V register(V value)
Register on the internal container- Parameters:
value
- to register- Returns:
- old value if any
-
remove
V remove(V value)
Remove value from map- Parameters:
value
- to remove- Returns:
- removed entry if any
-
clear
void clear()
Clear all entries from map
-
size
int size()
The number of registered entries- Returns:
- number of entries
-
isEmpty
boolean isEmpty()
Verify if the map is empty- Returns:
- true when empty false otherwise
-
contains
boolean contains(V value)
Check if value is already present- Parameters:
value
- to verify- Returns:
- true if present, false otherwise
-
toCollection
Collection<V> toCollection()
Collect values as unmodifiable collection- Returns:
- collection
-
valuesAsNewSet
Set<V> valuesAsNewSet()
Create a copy of the map's distinct values as a set- Returns:
- copt of values as set
-
findFirst
V findFirst(Predicate<V> valuePredicate)
Find first entry that matches the predicate- Parameters:
valuePredicate
- that checks a property of the value and the first which matches is returned- Returns:
- the retrieved entry, or null if no traveler type was found
-
clone
MapWrapper<K,V> clone()
Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created- Returns:
- copy
-
getKeyByValue
K getKeyByValue(V value)
collect the key used for the given value- Parameters:
value
- to collect used key for- Returns:
- key
-
getFirst
default V getFirst()
collect the first entry based on the iterator's result, which is not necessarily the fist entry ordered by the key, it is just the first entry the iterator would provide- Returns:
- first iterable entry, null if empty
-
addAll
default void addAll(Iterable<? extends V> iterable)
add all elements of iterable- Parameters:
iterable
- to add elements of
-
forEachIn
default <T extends V> void forEachIn(Collection<T> values, Consumer<T> consumer)
apply provided consumer to each element in values as long as that element is registered on this wrapper- Type Parameters:
T
- type of values- Parameters:
values
- to apply consumer to when they are registered in this wrapperconsumer
- to apply
-
-