Line | |
---|
1 | package com.ether; |
---|
2 | |
---|
3 | import org.apache.commons.lang.ArrayUtils; |
---|
4 | import org.jetbrains.annotations.NotNull; |
---|
5 | |
---|
6 | import java.util.ArrayList; |
---|
7 | import java.util.List; |
---|
8 | |
---|
9 | /** |
---|
10 | * @author vmipsl |
---|
11 | * @date 09 sept. 2011 |
---|
12 | */ |
---|
13 | public 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.