集合基于数组的实现:BagADT.java

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

/**

* @Author 陈伟兵

* @Msn:cwbnig1982@hotmail.com

* @E-mail:chenweibing1982@sohu.com

* @CreateTime 2004-11-30

* @Version:1.0

*/

package com.cwbnig.util;

import java.util.Iterator;

public interface BagADT

{

//Adds one element to this bag

public void add(Object element);

//Remove and returns a random element from the bag

public Object removeRandom()throws EmptyBagException;

//Removes and returns the specified element from this bag

public Object remove(Object element)throws EmptyBagException,NoSuchElementException;

//Returns the union of this bag and the parameter

public BagADT union(BagADT set);

//Returns true if this bag contains the parameter

public boolean contains(Object target);

//Returns true if this bag and the parameter contain exacitly the same elements

public boolean isEmpty();

//Returns the number of elements in this set

public int size();

//Returns an iterator for the elements in this bag

public Iterator iterator();

//Returns a string representation of this bag

public String toString();

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航