About 20,100,000 results
Open links in new tab
  1. generics - Java Class.cast () vs. cast operator - Stack Overflow

    Oct 12, 2009 · The Java C-style cast operator is much more restricted than the C/C++ version. Effectively the Java cast is like the C++ dynamic_cast if the object you have cannot be cast to the …

  2. Casting variables in Java - Stack Overflow

    Mar 13, 2011 · Pre Java-5 it was used heavily in collections and various other classes, since all collections worked on adding objects and then casting the result that you got back out the collection.

  3. java - Explicacion del Cast para que sirve, y cuando usarlo? - Stack ...

    0 El Cast es una operacion que permite que el objeto sea convertido en otro. Si comparte una estructura similar entre si, esto es recordando que son objetos y poseen la propiedad de …

  4. java - How to cast an Object to an int - Stack Overflow

    In Java enum members aren't integers but full featured objects (unlike C/C++, for example). Probably there is never a need to convert an enum object to int, however Java automatically associates an …

  5. java - Why cast after an instanceOf? - Stack Overflow

    Aug 9, 2015 · Java will only prevent you from doing dangerous unchecked casts if it can prove you are wrong, like with Circle c = new Circle(); Square s = (Square) c;. Casting/assigning to Object in the …

  6. How does Java Object casting work behind the scene?

    Possible Duplicate: How does the Java cast operator work? Java casting implementation I am always wondering how object casting works in Java. I understand for primitive type it will be more l...

  7. java - Type safety: Unchecked cast - Stack Overflow

    The problem is that a cast is a runtime check - but due to type erasure, at runtime there's actually no difference between a HashMap<String,String> and HashMap<Foo,Bar> for any other Foo and Bar.

  8. java - Unchecked cast from Object to List - Stack Overflow

    Mar 16, 2016 · I am trying to extend a solution to the problem posted here. The castList method shared there works greats for non-generic types. public static &lt;T&gt; List&lt;T&gt; castList(Object obj, …

  9. java: How to fix the Unchecked cast warning - Stack Overflow

    The dissension that this cast is save or not depends on the use case of the method and its context, in this case it depends almost on the method that is used to put the value in the map.

  10. Is it possible to cast a Stream in Java 8? - Stack Overflow

    Mar 22, 2017 · Is it possible to cast a stream in Java 8? Say I have a list of objects, I can do something like this to filter out all the additional objects: Stream.of(objects).filter(c -&gt; c instanceof Client)