wood burning stoves 2.0*
The moose likes Web Services and the fly likes How to return return a single record in a list of maps? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to return return a single record in a list of maps?" Watch "How to return return a single record in a list of maps?" New topic
Author

How to return return a single record in a list of maps?

Sharib Zafar
Greenhorn

Joined: Jan 30, 2010
Posts: 1
private List<Map<String, Object>> mapResponse(ConsultasWsRet[] resp){
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

for (ConsultasWsRet obj:resp){
Map<String, Object> ctxResponse = new HashMap<String, Object>();
ctxResponse.put(IContextDataKeys.MSISDN1, obj.getMSISDN());
ctxResponse.put(IContextDataKeys.MSISDN2, obj.getMSISDN2());
ctxResponse.put(IContextDataKeys.OPERATOR_DESCRIPTION, obj.getOperdescripcion());
ctxResponse.put(IContextDataKeys.OPERATOR_VIRTUAL_DESCRIPTION, obj.getOpervdescripcion());
ctxResponse.put(IContextDataKeys.OPERATOR_RECEPTOR, obj.getReceptor());
ctxResponse.put(IContextDataKeys.OPERATOR_VIRTUAL_RECEPTOR, obj.getReceptorVirtual());
ctxResponse.put(IContextDataKeys.CREATION_DATE, obj.getFechaCreacion());
ctxResponse.put(IContextDataKeys.LAST_DATE_MODIFICATION, obj.getFechaUltimaModificacion());
ctxResponse.put(IContextDataKeys.LAST_DATE_CANCEL, obj.getFechaVentanaDefinitiva());
ctxResponse.put(IContextDataKeys.COD_STATUS, obj.getEstado());

WebServiceClientUtil.readMap(ctxResponse, "Portabilidad - PT4 :: ConsultationPortabilityWebServiceClient :: Muestra los datos recibidos del servicio Web MPS -> ");

list.add(ctxResponse);
}
return list;
}
*****************************************************************************************************************************
The above program returns a List of Map.
I need to filter record based on the creation_date((IContextDataKeys.CREATION_DATE, obj.getFechaCreacion()) field from objects and compare them
to leave only the most recent. So in this sample you would leave an array with only one object.

how do i do this?
 
Don't get me started about those stupid light bulbs.
 
subject: How to return return a single record in a list of maps?
 
Similar Threads
How to retrieve metadata in ibatis
Question about template.queryForList
How to call StoredProcedure with mixed input data types?
Casting generics
Exception question