lundi 19 mars 2018

create map of not null value of an object using java 8 Generic

I have a model

class Foo {
   private int id;
   private String name;
   private String city;
}

setting

Foo foo = new Foo();
foo.setId(1);
foo.setName("foo test");

Now I want a generic method that return not null Map from any object. for example, in case of foo , it return map that contain id and name. any update ?





Aucun commentaire:

Enregistrer un commentaire