#cast a supplier

1 messages · Page 1 of 1 (latest)

fringe plume
#

how do i cast a supplier
Supplier<Class> -> Supplier<SuperClass>

toxic oysterBOT
#

<@&987246399047479336> please have a look, thanks.

toxic oysterBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

fringe plume
#

because i have to

#

it takes in a Supplier<Super>

#

and i extend Super so i can add some custom things to it

lapis osprey
#

explain your problem please

#

that's a xy question

fringe plume
#

not really

#

i can give an example but

#

i have an Supplier<Inventory>

#

the method takes in an Supplier<Container>

#

Inventory implements Container

#

if i use .get and then a supplier than it defeats the whole purppose of the supplier

lapis osprey
#

why do you have a supplier<inventory> at the first place

fringe plume
#

i guess i can add another parameter

#

but now i have

#

which is ugly

#

thought i could maybe do it cleaner

lapis osprey
#

what's the problem ?

#

why is it ugly ?

fringe plume
#

idk seems dumb passing in the same thing twice

lapis osprey
fringe plume
#

eh this works fine i guess

sullen sinew
#

or refactor the method, if its the same input anyway ...

fringe plume
#

well i cant is the thing

#

one gets cast and one doesnt

sullen sinew
#

shouldnt stop u from only using one in the signature

fringe plume
#

Well it did pepekek

#

That’s why I asked how to cast it

urban vortex
#

Can you show the method that's being called?

slim geode
#

@fringe plume In your argument list take a Supplier<? extends SuperClass>

#

then you don't need to cast