当前位置: 技术问答>java相关
如何处理collection对象
来源: 互联网 发布时间:2015-05-25
本文导语: 当我将几个实体bean作为一个collection对象返回给客户端,如何处理collection得到具体的bean! | public Iterator iterator() Returns an iterator over the elements in this collection. There are no guarantees concernin...
当我将几个实体bean作为一个collection对象返回给客户端,如何处理collection得到具体的bean!
|
public Iterator iterator()
Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee).
Returns:
an Iterator over the elements in this collection
--------------------------------------------------------------------------------
toArray
public Object[] toArray()
Returns an array containing all of the elements in this collection. If the collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
Returns:
an array containing all of the elements in this collection
Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee).
Returns:
an Iterator over the elements in this collection
--------------------------------------------------------------------------------
toArray
public Object[] toArray()
Returns an array containing all of the elements in this collection. If the collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
Returns:
an array containing all of the elements in this collection
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。