Вопрос по java – Java - ли возвращение значения разорвать цикл?

35

Error: User Rate Limit Exceeded

public static boolean isIncluded(E element) {
    Node<E> c = head;
    while (c != null) {
        if (cursor.getElement().equals(element)) {
            return true;
        }
        c = c.getNext();
    }
    return false;
}

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded Matt Ball
Error: User Rate Limit Exceeded Joshua Pinter
Error: User Rate Limit Exceeded Voo
Error: User Rate Limit Exceeded Andreas Petersson

Ваш Ответ

5   ответов
10

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
15

Error: User Rate Limit Exceeded

continue;

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded
0

84
Yes*

usually

An Exception

while (true)
{
    try
    {
        return;  // This return technically speaking doesn't exit the loop.
    }
    finally
    {
        while (true) {}  // Instead it gets stuck here.
    }
}
Error: User Rate Limit Exceeded
18

finallysynchronized

Похожие вопросы