2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.util;
10 import java.util.Collection;
11 import java.util.Iterator;
14 public class RemoveOnlySet<E> implements Set<E> {
15 private final Set<E> set;
17 public RemoveOnlySet(final Set<E> set) {
21 public static <T> RemoveOnlySet<T> wrap(final Set<T> set) {
22 return new RemoveOnlySet<T>(set);
26 public boolean add(final E e) {
27 throw new UnsupportedOperationException("Set does not accept additions");
31 public boolean addAll(final Collection<? extends E> c) {
32 throw new UnsupportedOperationException("Set does not accept additions");
41 public boolean contains(final Object o) {
42 return set.contains(o);
46 public boolean containsAll(final Collection<?> c) {
47 return set.containsAll(c);
51 public boolean isEmpty() {
56 public Iterator<E> iterator() {
57 return set.iterator();
61 public boolean remove(final Object o) {
66 public boolean removeAll(final Collection<?> c) {
67 return set.removeAll(c);
71 public boolean retainAll(final Collection<?> c) {
72 return set.retainAll(c);
81 public Object[] toArray() {
86 public <T> T[] toArray(final T[] a) {
87 return set.toArray(a);