Here you can find the source of equals(Collection
public static boolean equals(Collection<String> asCollection, String[] values)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.Collection; import java.util.List; public class Main { /**//w w w .j a v a2s . c om * Compare a collection of strings to an array of strings. */ public static boolean equals(Collection<String> asCollection, String[] values) { final List<String> asList = Arrays.asList(values); final boolean containsAll = asCollection.containsAll(asList); final int size = asCollection.size(); final int length = values.length; return containsAll && length == size; } }