Why does TableCloumn <S, T> accept 2 elements?

The JavaDoc says:

Type Parameters:
    S - The type of the TableView generic type (i.e. S == TableView<S>)
    T - The type of the content in all cells in this TableColumn.

What does the generic type mean in this context? If the content is a string, the generic type will also be a string, right?

I am trying to compile the following code with String:

TableColumn col = new TableColumn<?, String>();

public void append(String str) {
  col.add(str);
}

Why can't I do this?

+3
source share
1 answer
  • S is your domain object
  • T is the value of the domain object that you want in this column.

Please take a look at Javadoc for such questions:

http://docs.oracle.com/javafx/2/api/javafx/scene/control/TableView.html

0
source

All Articles