1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.utils.datastructures;
14 import java.util.Collection;
15 import java.util.Iterator;
17 public abstract class ImmutableCollection<T> implements Collection<T> {
19 public boolean add(T e) {
20 throw new UnsupportedOperationException();
23 public boolean addAll(Collection<? extends T> c) {
24 throw new UnsupportedOperationException();
28 throw new UnsupportedOperationException();
31 public boolean remove(Object o) {
32 throw new UnsupportedOperationException();
35 public boolean removeAll(Collection<?> c) {
36 throw new UnsupportedOperationException();
39 public boolean retainAll(Collection<?> c) {
40 throw new UnsupportedOperationException();
43 abstract public boolean contains(Object o);
44 abstract public boolean containsAll(Collection<?> c);
45 abstract public boolean isEmpty();
46 abstract public Iterator<T> iterator();
47 abstract public int size();
49 public Object[] toArray() {
50 Object[] ret = new Object[size()];
57 public <U> U[] toArray(U[] a) {
59 throw new UnsupportedOperationException();