@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MappedResource<?> other = (MappedResource<?>)obj; if (pathSpec == null) { if (other.pathSpec != null) { return false; } } else if (!pathSpec.equals(other.pathSpec)) { return false; } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MappedResource<?> other = (MappedResource<?>)obj; if (pathSpec == null) { if (other.pathSpec != null) { return false; } } else if (!pathSpec.equals(other.pathSpec)) { return false; } return true; }
public E get(PathSpec spec) { Optional<E> optionalResource = _mappings.stream() .filter(mappedResource -> mappedResource.getPathSpec().equals(spec)) .map(mappedResource -> mappedResource.getResource()) .findFirst(); if(!optionalResource.isPresent()) return null; return optionalResource.get(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MappedResource<?> other = (MappedResource<?>)obj; if (pathSpec == null) { if (other.pathSpec != null) { return false; } } else if (!pathSpec.equals(other.pathSpec)) { return false; } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MappedResource<?> other = (MappedResource<?>)obj; if (pathSpec == null) { if (other.pathSpec != null) { return false; } } else if (!pathSpec.equals(other.pathSpec)) { return false; } return true; }
public E get(PathSpec spec) { Optional<E> optionalResource = _mappings.stream() .filter(mappedResource -> mappedResource.getPathSpec().equals(spec)) .map(mappedResource -> mappedResource.getResource()) .findFirst(); if(!optionalResource.isPresent()) return null; return optionalResource.get(); }
@Override public boolean removeMapping(String rawspec) { PathSpec pathSpec = toPathSpec(rawspec); boolean removed = false; for (Iterator<MappedResource<WebSocketCreator>> iterator = mappings.iterator(); iterator.hasNext(); ) { MappedResource<WebSocketCreator> mapping = iterator.next(); if (mapping.getPathSpec().equals(pathSpec)) { iterator.remove(); removed = true; } } return removed; }
@Override public WebSocketCreator getMapping(String rawspec) { PathSpec pathSpec = toPathSpec(rawspec); for (MappedResource<WebSocketCreator> mapping : mappings) { if (mapping.getPathSpec().equals(pathSpec)) return mapping.getResource(); } return null; }
while (iter.hasNext()) if (iter.next().getPathSpec().equals(pathSpec))
while (iter.hasNext()) if (iter.next().getPathSpec().equals(pathSpec))