--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.utils.datastructures;\r
+\r
+import java.util.Collection;\r
+import java.util.Iterator;\r
+\r
+public abstract class ImmutableCollection<T> implements Collection<T> {\r
+\r
+ public boolean add(T e) {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ public boolean addAll(Collection<? extends T> c) {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ public void clear() {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ public boolean remove(Object o) {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ public boolean removeAll(Collection<?> c) {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ public boolean retainAll(Collection<?> c) {\r
+ throw new UnsupportedOperationException();\r
+ }\r
+\r
+ abstract public boolean contains(Object o);\r
+ abstract public boolean containsAll(Collection<?> c);\r
+ abstract public boolean isEmpty();\r
+ abstract public Iterator<T> iterator(); \r
+ abstract public int size();\r
+ \r
+ public Object[] toArray() {\r
+ Object[] ret = new Object[size()];\r
+ int i=0;\r
+ for(T a : this) \r
+ ret[i++] = a;\r
+ return ret;\r
+ }\r
+\r
+ public <U> U[] toArray(U[] a) {\r
+ // TODO\r
+ throw new UnsupportedOperationException();\r
+ }\r
+ \r
+}\r