Java tutorial
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /** Returns true if all elements of c match obj */ public static boolean all(Collection c, Object obj) { for (Iterator iterator = c.iterator(); iterator.hasNext();) { Object o = iterator.next(); if (!o.equals(obj)) return false; } return true; } }