Wednesday, November 13, 2019

Java List vs List<?> vs List<Object>

Before generics were introduced developers used lists as List which means you can store any type of objects including null inside it and when you read it you need to cast it
List list = new ArrayList();
list.add("String test");
list.add(new Date());

String s = (String) list.get(0);
From code above you can expect ClassCastException because if you try to assign 2nd item to String it will not succeed and you will get an exception during runtime. To prevent it you need to check if your type is correct and then cast as below

Friday, May 3, 2019

What kind of benefits you can expect in Poland

Hey, 

I relocated to Poland(Krakow) in 2017 and I'm very happy to be here. I just regret that why I didn't do it 5-10 years ago :) 

Except nice and kind people, beautiful, old and safe city you can even expect a lot of benefits from the government and companies. Today I want to share all kind of benefits which I know and use here. If you know additional ones please feel free to leave them in the comment, I'll be happy to check it and add to the list :)