java - Getting statistics from resultset -


i have resultset returns 5 values. set data in pojo, , added pojo list.

datapojo = new outputviewdatapojo(); datapojo.settime(resultado.getint(1)); datapojo.setcommanddesc(resultado.getstring(2)); datapojo.setokerror(resultado.getstring(3)); datapojo.setresultdesc(resultado.getstring(4)); datapojo.setresultcode(resultado.getint(5));                     listpojo.add(datapojo);      [description:call connect, timestamp:0, okerror:ok, resultcode:0, resultdesc:null.]     [description:waiting open complete, timestamp:2468, okerror:ok, resultcode:0, resultdesc:null.]     [description:reading card, timestamp:0, okerror:ok, resultcode:0, resultdesc:null.]     [description:waiting read card, timestamp:10329, okerror:ok, resultcode:0, resultdesc:null.]     [description:reading card, timestamp:0, okerror:ok, resultcode:0, resultdesc:null.]     [description:waiting read card, timestamp:6671, okerror:ok, resultcode:0, resultdesc:null.]     [description:reading card, timestamp:0, okerror:ok, resultcode:0, resultdesc:null.]     [description:waiting read card, timestamp:6704, okerror:ok, resultcode:0, resultdesc:null.]     [description:reading card, timestamp:0, okerror:ok, resultcode:0, resultdesc:null.]     [description:waiting read card, timestamp:6578, okerror:ok, resultcode:0, resultdesc:null.]     [description:reading card, timestamp:0, okerror:ok, resultcode:0, resultdesc:null.]     [description:waiting read card, timestamp:6578, okerror:ok, resultcode:0, resultdesc:null.]     [description:reading card, timestamp:0, okerror:ok, resultcode:0, resultdesc:null.]     [description:waiting read card, timestamp:6594, okerror:ok, resultcode:0, resultdesc:null.] 

the top listed data printed in console, question: how can sum of timestamp description "waiting read card". need statistics, in case getting media value of timestamp every description , don´t know how that. please, me!

if want store data in database , retrieve , need create database , table (f.e. user) these columns

name -age -city -car model -house type 

then can store data ( insert user(name, age, city, car_model, house_type) values (?,?,?,?,?) , retrieve (select * user city = 'madrid') etc.

you have pojo entity mentioned in 1 comments :

public class user {    private int id;    private string name;    private int age;    private string city;    private string carmodel;    private string housetype;    //getters , setters } 

create corresponding table in database, , manipulate data insert, select queries.

if don't want store data in database, can create maps easy filtering. f.e.

 user user = ...; //an instance of user  map<string, list<user>> usercitymap = new hashmap<string,list<user>>();   list<user> userwiththatcity = map.get(user.getcity());  if(userwiththatcity == null)  {    userwiththatcity = new arraylist<user>();    usercitymap.put(user.getcity(), userwiththatcity);  }  userwiththatcity.add(user);  ... 

i hope help.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -