联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> javajava

日期:2018-09-18 03:01

/**


*/

public interface BagInterface<T>

{

   /** Gets the current number of entries in this bag.

    @return  The integer number of entries currently in the bag. */

   public int getCurrentSize();


   /** Retrieves all entries that are in this bag.

    @return  A newly allocated array of all the entries in the bag.

    Note: If the bag is empty, the returned array is empty. */

   public T[] toArray();


/** Adds a new entry to the head of this bag.

   @param newEntry  The object to be added as a new entry.

   @return  True if the addition is successful, or false if not. */

public boolean addToHead(T newEntry);


   /** Adds a new entry to the tail of this bag.

    @param newEntry  The object to be added as a new entry.

    @return  True if the addition is successful, or false if not. */

   public boolean addToTail(T newEntry);


   /** Removes one unspecified entry from the head of this bag, if possible.

      @return  Either the removed entry, if the removal.

               was successful, or null. */

public T removeHead();


   /** Removes one entry from the tail of this bag, if possible.

    @return  Either the removed entry, if the removal.

    was successful, or null. */

   public T removeTail();


} // end BagInterface


版权所有:留学生程序网 2020 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。