Skip to main content

Posts

Showing posts with the label jtree

Error while working with List<? extends DefaultMutableTreeNodel>

public void findClassNodesMatching(String lowerCaseSearchText, List<? extends DefaultMutableTreeNode> foundNodes) { findClassNodesMatching(lowerCaseSearchText, (DefaultMutableTreeNode) getRoot(), foundNodes); } private void findClassNodesMatching(String lowerCaseSearchText, DefaultMutableTreeNode node, List<? extends DefaultMutableTreeNode> foundNodes) { String nodeLabel = node.toString().toLowerCase(); if (nodeLabel.indexOf(lowerCaseSearchText) >= 0) { foundNodes.add(node); } } Why does this code give an error The method add(capture#2-of ? extends DefaultMutableTreeNode) in the type List is not applicable for the arguments (DefaultMutableTreeNode) The error is at the line of foundNodes.add(node);