Uglifying touch



  • No, "docs.addAll(allDocs());" is just too easy.

    docs.addAll((List)Arrays.asList(allDocs().toArray()));
    

    allDocs() returns a Collection.
    Makes an array of it, then wrapping that in a List.
    The final WTF is casting the returned List to a List. Yeah, lets do that.

    Please, my ex-colleague, please consider moving back to VB.

    PS: I didn't know that a <pre > was unacceptable and <pre> is the only true way. I learn something every day.



  • @ounos said:

    No, "docs.addAll(allDocs());" is just too easy.

    docs.addAll((List)Arrays.asList(allDocs().toArray()));

    allDocs() returns a Collection.
    Makes an array of it, then wrapping that in a List.

     

    Maybe when the code was made addAll() didn't support Collections.

    @ounos said:

    The final WTF is casting the returned List to a List.

    No WTF here. This kind of handling throws occasional warnings (not in VB), so normal.



Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.