Linked Questions

15 votes
2 answers
15k views

Possible Duplicate: Java Generics Hi, Can anyone please explain the difference of the three and each proper usage? Thanks, been googling but I'm still confused on how to use each. czetsuya
czetsuya's user avatar
  • 5,153
5 votes
6 answers
951 views

Possible Duplicate: Java Generics In Eclipse, I am given warnings for using 'rawtypes' and one of it's fixes is to add <?>. For example: Class parameter = String.class; //Eclipse ...
trigoman's user avatar
  • 3,715
2 votes
5 answers
337 views

Possible Duplicate: Java Generics To be more specific, whats the role of the <String> in the following line of code? private List<String> item = new ArrayList<String>();
Emanuil Rusev's user avatar
0 votes
4 answers
123 views

I am manipulating some code and unfortunately I cannot understand this part of it: public class InMemoryTreeStateManager<T> implements TreeStateManager<T> What is the meaning of <T>....
Sal-laS's user avatar
  • 11.7k
-1 votes
10 answers
168 views

I am new to java. I would like to know what is <> used for in java. This is an example where I get confused: List<File> sourceFileList = new ArrayList<File>
su_darell's user avatar
1 vote
0 answers
274 views

According to JEP 395 a record with additional constructors can be used: public record Aliases(List<String> value) { public Aliases(Integer raw) { this(List.of(raw.toString())); ...
spCH's user avatar
  • 79
-3 votes
1 answer
64 views

private List<Manufacturer> productManufacturer = new LinkedList<Manufacturer>(); I am not able to understand why <> this symbol is here and Manufacturer inside it to define a ...
Aashish Sapkota's user avatar
-2 votes
1 answer
82 views

I am hoping somebody can explain to me what a <T> object is, just a little confused on what it is/what it contains. Thank you
Connor Pratt's user avatar
0 votes
1 answer
59 views

I'm taking Algorithms I on coursera and came across the implementation of a Data Structure called Bag. http://algs4.cs.princeton.edu/13stacks/Bag.java.html However I don't undertand why the use a ...
Rodrigo Proença's user avatar
0 votes
0 answers
54 views

If I use ArrayAdapter or ArrayAdapter<String>, it does not affect my code. For example, if I write it like: ArrayAdapter adapter = new ArrayAdapter(getApplicationContext(), android.R.layout....
krupal's user avatar
  • 884
209 votes
10 answers
185k views

What are the differences between List, List<?>, List<T>, List<E>, and List<Object>? 1. List List: is a raw type, therefore not typesafe. It will only generate a runtime error ...
Thang Pham's user avatar
  • 38.8k
92 votes
6 answers
211k views

I was wondering if it's possible to write a function that accepts multiple generic types as follows: public int void myfunction(Set<T> a, Set<T> b) { return 5; } Set<Integer> ...
rxmnnxfpvg's user avatar
  • 31.2k
51 votes
3 answers
46k views

I don't really understand the point of generics. What do they do, how do you use them? From what I can tell, all they do is check return types at compile times instead of run times to avoid running ...
switz's user avatar
  • 25.3k
15 votes
6 answers
8k views

Why do we lose type safety when using List and not while using List<Object>? Aren't they basically the same thing? EDIT: I found that the following gives a compilation error public class ...
Varun Achar's user avatar
  • 15.2k
3 votes
3 answers
2k views

Over the years I seen many people use the word "generics", I honestly have not a clue what it means, whatever it is I most likely use it but just don't know that it was called that. :p
Rifk's user avatar
  • 289

15 30 50 per page