List of usage examples for org.apache.commons.collections CollectionUtils unmodifiableCollection
public static Collection unmodifiableCollection(Collection collection)
From source file:scratch.joshua.jung_2_0.core.SimpleDirectedSparseGraph.java
public Collection<V> getSuccessors(V vertex) { Set<E> outgoing = vertices.get(vertex).getSecond(); Set<V> succs = new HashSet(); for (E edge : outgoing) succs.add(this.getDest(edge)); return CollectionUtils.unmodifiableCollection(succs); }
From source file:scratch.joshua.jung_2_0.core.SimpleUndirectedSparseGraph.java
public Collection<E> getEdges() { return CollectionUtils.unmodifiableCollection(edges.keySet()); }
From source file:scratch.joshua.jung_2_0.core.SimpleUndirectedSparseGraph.java
public Collection<V> getVertices() { return CollectionUtils.unmodifiableCollection(vertices.keySet()); }
From source file:scratch.joshua.jung_2_0.core.SimpleUndirectedSparseGraph.java
public Collection<V> getNeighbors(V vertex) { Set<E> incident_edges = vertices.get(vertex); Set<V> neighbors = new HashSet<V>(); for (E edge : incident_edges) { Pair<V> endpoints = this.getEndpoints(edge); V e_a = endpoints.getFirst();/*w ww .ja v a2 s . co m*/ V e_b = endpoints.getSecond(); if (vertex.equals(e_a)) neighbors.add(e_b); else neighbors.add(e_a); } return CollectionUtils.unmodifiableCollection(neighbors); }
From source file:scratch.joshua.jung_2_0.core.SimpleUndirectedSparseGraph.java
public Collection<E> getIncidentEdges(V vertex) { return CollectionUtils.unmodifiableCollection((Set) vertices.get(vertex)); }