abstractset.java

来自「kaffe是一个java虚拟机的源代码。里面包含了一些java例程和标准的jav」· Java 代码 · 共 58 行

JAVA
58
字号
/* * Java core library component. * * Copyright (c) 1999 *	Archie L. Cobbs.  All rights reserved. * Copyright (c) 1999 *	Transvirtual Technologies, Inc.  All rights reserved. * * See the file "license.terms" for information on usage and redistribution * of this file. * * Author: Archie L. Cobbs <archie@whistle.com> */package java.util;public abstract class AbstractSet extends AbstractCollection implements Set {	protected AbstractSet() {	}	public boolean equals(Object o) {		if (o == this) {			return true;		}		if (!(o instanceof Set)) {			return false;		}		Set that = (Set)o;		if (that.size() != this.size()) {			return false;		}		return containsAll(that);	}	public int hashCode() {		int sum = 0;		for (Iterator i = iterator(); i.hasNext(); ) {			Object next = i.next();			sum += next == null ? 0 : next.hashCode();		}		return sum;	}	public boolean removeAll(Collection c) {		if (size() < c.size())			return super.removeAll(c);		boolean status = false;		for (Iterator i = c.iterator(); i.hasNext(); ) {			if (remove(i.next()))				status = true;		}		return status;	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?