java - Warning with List<String> on Android -
i want solve warning. in part of code have warning: type safety: unchecked cast object list<string>
string preferences = pprefs.getstring(sharedpreferences); objectmapper mapper = new objectmapper(); byte[] bytetemp = mapper.readvalue(preferences, byte[].class); bytearrayinputstream in = new bytearrayinputstream(bytetemp); objectinputstream = new objectinputstream(in); list<string> numbers = (list<string>) is.readobject();
how can do? thank all.
objectinputstream::readobject
returns object
.
you casting list<string>
without first checking if list<string>
. far compiler knows, can kind of object
(a string
, integer
, , on...)
Comments
Post a Comment