Questions tagged [parameterized-class]

9 questions
7
votes
1 answer

Raw use of parameterized class on Android Studio

I have this code on my Android project: final BottomSheetBehavior infoBottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.info_view)); infoBottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback()…
Tsilaicos
  • 435
  • 2
  • 13
4
votes
2 answers

Fixed type parameter in alternative constructor

Can this be done? final case class C[A] (v: A) { def this() = this(true) } When constructed with given constructor, C is automatically a C[Boolean]. This version does not compile but it feels like it should be doable somehow, especially as the…
scand1sk
  • 1,114
  • 11
  • 25
3
votes
0 answers

Using Reflections.getSubTypeOf() to get subtypes of Parameterized interface

I'm trying to extract all classes that implement an interface and put these in a Set. However, that interface is Parameterized and I'd like to communicate that it's all subclasses, regardless of their "parameter" I want, using a wildcard or…
3
votes
2 answers

Java Generic For Parameterized Class : Unbounded Wildcards vs Raw Type

I have a parameterized interface RestHandler. public interface RestHandler { blah blah blah... } And I need to create a class from config using Class.forName. Now I come up with three version , which ALL compiles successfully. Version…
2
votes
2 answers

Apache Spark having Dataset of a parameterised/generic class in Java

I've always wandered if having a Dataset of a parameterised/generic class is possible in Java. To be more clear, what I am looking to achieve is something like this: Dataset> myClassInteger; Dataset>…
1
vote
3 answers

Trouble with encapsulating "recursive types" in Scala

Sorry, I have hard times figuring out a relevant title for my problem. I want to model the following behavior: I designed a "language" with expressions that encapsulate standard Scala types. Expressions can be either variables or sequences of…
scand1sk
  • 1,114
  • 11
  • 25
0
votes
2 answers

How to copy and filtered an ImmutableList in Java

Basically, I want to have public ImmutableList getFilteredList(ImmutableList initial) { ArrayList newList = new ArrayList(); for (MyObject temp: initial) { …
0
votes
2 answers

Wildcard parameterized type in Java

I had been reading up on Generics in Java. In the Wildcard section in the tutorial below all examples are for parameterized methods. It got me thinking of why is there no example for wildcard parameterized type…
VedVrat
  • 103
  • 3
  • 12
0
votes
1 answer

Get actual enum class of the Parameterized class T extends Enum

I have a class: public class MultipleSorting> { private T criteriaType; public Class getCriteriaClass() { Field field = ReflectionUtils.getField(getClass(),"criteriaType"); …
Tapas Bose
  • 28,796
  • 74
  • 215
  • 331