About 5,070,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 …

  2. 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 …

  3. 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 …

  4. 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 …

  5. 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.

  6. 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 …

  7. java - How to cast List<Object> to List<MyClass> - Stack Overflow

    Nov 29, 2016 · you can always cast any object to any type by up-casting it to Object first. in your case: (List<Customer>)(Object)list; you must be sure that at runtime the list contains nothing …

  8. java - How do I address unchecked cast warnings? - Stack Overflow

    You have to suppress the compile time unchecked cast no matter what you do at runtime. I'd just prefer to blind cast and let the JVM perform its runtime check for me since we "know" what the …

  9. 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 …

  10. java - What is unchecked cast and how do I check it? - Stack …

    Apr 22, 2010 · An unchecked cast, as opposed to checked cast, does not check type safety at runtime. Here's an example based on the Consider typesafe heterogenous containers section …