public static Map
group(List<DeviceGps> target) |
02 |
{ |
03 |
Map<Integer,
List<DeviceGps>> gpsMap= new HashMap<Integer,
List<DeviceGps>>(); |
04 |
for ( int i
= 0 ;
i < target.size(); i++) |
05 |
{ |
06 |
DeviceGps
myObject = target.get(i); |
07 |
int operatorID=myObject.getOperator_id(); |
08 |
List<DeviceGps>
gpsList = gpsMap.get(operatorID); |
09 |
if (gpsList== null )
{ |
10 |
gpsList
= new ArrayList<DeviceGps>(); |
11 |
gpsMap.put(operatorID,
gpsList); |
12 |
} |
13 |
gpsList.add(myObject); |
14 |
} |
15 |
return gpsMap; |
16 |
}
|