Custom Collector

i try to write a custom collector, but the supllier function keeps saying type mismatch. the input is a ResourceType, the output should be a set of strings. im not sure what type i should name for the accumulator function tho ^^" (java version 20 i think)
public interface KeywordCollector extends Collector<RessourceType, List<String>, Set<String>> {}



public class PlainTextCollector implements KeywordCollector {
public Supplier<List<String>> supplier() {
return new ArrayList<String>();
}
}
public interface KeywordCollector extends Collector<RessourceType, List<String>, Set<String>> {}



public class PlainTextCollector implements KeywordCollector {
public Supplier<List<String>> supplier() {
return new ArrayList<String>();
}
}
Type mismatch: cannot convert from List<String> to Supplier<List<String>>Java(16777235)
6 Replies
JavaBot
JavaBot2y ago
This post has been reserved for your question.
Hey @' .• KIΛ.RΛR ’•. '! Please use /close or the Close Post` button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Kyo-chan
Kyo-chan2y ago
You're supposed to return a supplier of lists, not just one list
' .•` KIΛ.RΛR ’•. '
whatb is a supllier of lists?
Kyo-chan
Kyo-chan2y ago
It's something that supplies a list, curiously enough. Usually by creating it try return ArrayList::new;
JavaBot
JavaBot2y ago
Post Closed
This post has been closed by <@586905336850677760>.
Want results from more Discord servers?
Add your server