Skip to content

Tag: java

Instantiate generic classes with different constructor arguments

I have two similar classes, Foo and Bar And I’ve got two methods in another class that creates a Set of Foo (1st method) and Bar (2nd method) and are pretty much the same. The first one: And the second one: As you can see, both methods are pretty much the same so I thought I could use generics to

Retrieving data from LDAP

I want to fetch data from LDAP server. I can retrieve all users from the list. But now, what I want to do is get the person list under ‘directReports’ attribute. It returns users as java Objects. I cannot convert them to any type other than toString(). What I have done is convert objects to String…