![](/img/trans.png)
[英]Finding uppercase in linkedlist and returning new linkedlist with found elements?
[英]Returning LinkedList of uppercase Characters when given a LinkedList
老實說,我現在真的只是在這個問題上停留了,並不真正知道該怎么做。 我需要編寫一個方法,給我一個字符鏈接列表(例如:{'a','A','d','X'})並返回僅包含大寫字符的列表(返回:{' A','X'})。 我該如何編寫該程序?
import org.w3c.dom.Node;
public class ListExample {
public final class Node<T> {
public final T value;
public Node<T> next;
public Node(T _value) {
this( _value, null );
}
public Node(T _value, Node<T> _next) {
value = _value;
next = _next;
}
@Override
public String toString() {
return "" + value;
}
}
public static Node<Character> getUppercaseList(Node<Character> head) {
Node<Character> tail = null;
Node<Character> result = null;
while(head != null) {
}
return null;
}
}
感謝您提供的所有幫助!
遍歷字符列表,建立大寫字母列表。 如果使用的是Java8,則對isUpperCase()
方法進行過濾。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.