Wednesday, September 13, 2017

Java syntax question.

Hi there,

I don't know what the Java syntax below would mean (<?>). I hope someone can help. It looks so similar to Java generic method, but I can't find any tutorial for it.

Thank you.

public <T> NodeInfo<?> getNodeInfo(T value) {
    if (value == null) {
      // Return top level categories.
      return new DefaultNodeInfo<Category>(categoryDataProvider, new CategoryCell(images.contactsGroup()));
    } else if (value instanceof Category) {
      // Return the first letters of each first name.
      Category category = (Category) value;
      List<ContactInfo> contacts = ContactDatabase.get().queryContactsByCategory(category);
      Map<Character, LetterCount> counts = new TreeMap<Character, LetterCount>();
      for (ContactInfo contact : contacts) {
        Character first = contact.getFirstName().charAt(0);
        LetterCount count = counts.get(first);
        if (count == null) {
          count = new LetterCount(category, first);
          counts.put(first, count);
        } else {
      List<LetterCount> orderedCounts = new ArrayList<LetterCount>(counts.values());
      return new DefaultNodeInfo<LetterCount>(new ListDataProvider<LetterCount>(orderedCounts), new LetterCountCell());
    } else if (value instanceof LetterCount) {
      // Return the contacts with the specified character and first name.
      LetterCount count = (LetterCount) value;
      List<ContactInfo> contacts = ContactDatabase.get().queryContactsByCategoryAndFirstName(count.category, count.firstLetter + "");
      ListDataProvider<ContactInfo> dataProvider = new ListDataProvider<ContactInfo>(contacts, ContactInfo.KEY_PROVIDER);
      return new DefaultNodeInfo<ContactInfo>(dataProvider, contactCell, selectionModel, selectionManager, null);

    // Unhandled type.
    String type = value.getClass().getName();
    throw new IllegalArgumentException("Unsupported object type: " + type);

You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment