Ample constructs/solutions to get the result you need. Pierre Smits
*ORRTIZ.COM <http://www.orrtiz.com>* Services & Solutions for Cloud- Based Manufacturing, Professional Services and Retail & Trade http://www.orrtiz.com On Wed, Sep 10, 2014 at 12:00 PM, Adrian Crum < [email protected]> wrote: > So does java.util.LinkedList. > > Adrian Crum > Sandglass Software > www.sandglass-software.com > > > On 9/10/2014 10:43 AM, Jacques Le Roux wrote: > >> BTW, I just realise that FastList has getFirst() and getLast() methods >> (only getLast() is used, twice in OFBiz code) >> >> Jacques >> >> Le 10/09/2014 11:05, Jacques Le Roux a écrit : >> >>> Actually I thought about it even before sending and I guess it's >>> because people are using an ASC or DESC sort in function of their >>> need, so getLast is not needed, agreed? >>> >>> Jacques >>> >>> Le 10/09/2014 09:53, Jacques Le Roux a écrit : >>> >>>> I want to introduce a getLast in EntityUtil class like we have getFirst >>>> But I wonder if some of you are not doing it otherwise, because I >>>> find strange that it's not already there. >>>> >>>> It would be: >>>> >>>> --- a/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java >>>> +++ b/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java >>>> @@ -86,6 +86,26 @@ public class EntityUtil { >>>> } >>>> } >>>> >>>> + public static GenericValue getLast(Collection<GenericValue> >>>> values) { >>>> + if (UtilValidate.isNotEmpty(values)) { >>>> + Iterator<GenericValue> itr = values.iterator(); >>>> + GenericValue lastElement = itr.next(); >>>> + while(itr.hasNext()) { >>>> + lastElement=itr.next(); >>>> + } >>>> + return lastElement; >>>> + } >>>> + return null; >>>> + } >>>> + >>>> + public static GenericValue getLast(List<GenericValue> values) { >>>> + if (UtilValidate.isNotEmpty(values)) { >>>> + return values.get(values.size() - 1); >>>> + } else { >>>> + return null; >>>> + } >>>> + } >>>> + >>>> >>>> Jacques >>>> >>>> >>>
