source: ether_megapoli/trunk/common/implementation/com/ether/EtherHelper.java @ 191

Last change on this file since 191 was 191, checked in by vmipsl, 13 years ago

Servlet _ Contour en cours

File size: 970 bytes
Line 
1package com.ether;
2
3import org.apache.commons.lang.ArrayUtils;
4import org.jetbrains.annotations.NotNull;
5
6import java.util.ArrayList;
7import java.util.List;
8
9/**
10 * @author vmipsl
11 * @date 09 sept. 2011
12 */
13public abstract class EtherHelper
14{
15    /**
16     * This method returns the list with the second values of a list of <Pair>
17     *
18     * @param pairList
19     * @return
20     */
21    @NotNull
22    public static <T1, T2> List getSecondValues( @NotNull final List<Pair<T1, T2>> pairList )
23    {
24        final List secondValues = new ArrayList<T2>( pairList.size() );
25        for( final Pair pair : pairList )
26            secondValues.add( pair.getSecondValue() );
27
28        return secondValues;
29    }
30
31    public static double[] convertListDoubleToDoubleArray(@NotNull final List<Double> list)
32    {
33        Double[] doubleArray = new Double[list.size()];
34        doubleArray = list.toArray( doubleArray );
35        return ArrayUtils.toPrimitive( doubleArray );
36    }
37
38}
Note: See TracBrowser for help on using the repository browser.