0

请注意,BinarySearchTree 类来自 net.datastructures 5.0

   public static <K, V extends Comparable> List<Entry<K, V>> sortTree(BinarySearchTree<K, V> tree) 
    {   
        List<Entry<K, V>> entries = new ArrayList<Entry<K, V>>(tree.size()); 
        entries.addAll(tree.entries());

我将如何解决这个问题?

 Error: The method addAll(Collection<? extends Entry<K,V>>) in the type List<Entry<K,V>> is not applicable for the arguments (Iterable<Entry<K,V>>)
4

1 回答 1

0
for(Entry<K,V> entry : tree.entries()) { entries.add(entry);}
于 2012-11-30T10:45:56.583 回答