Example usage for com.google.gwt.coreext.client JSOArray splice

List of usage examples for com.google.gwt.coreext.client JSOArray splice

Introduction

In this page you can find the example usage for com.google.gwt.coreext.client JSOArray splice.

Prototype

public final native JSOArray<T> splice(int index, int count) ;

Source Link

Usage

From source file:com.google.speedtracer.client.model.NetworkEventDispatcher.java

License:Apache License

/**
 * @param identifier Resource ID//www.ja  va  2  s. co m
 * @param url The redirect URL that we are using to match a redirect
 *        candidate.
 */
private NetworkResource findAndRemoveRedirectCandidate(String identifier, String url) {
    // Look for it.
    JSOArray<NetworkResource> redirectCandidates = redirects.get(identifier);
    if (redirectCandidates == null) {
        return null;
    }

    for (int i = 0; i < redirectCandidates.size(); i++) {
        NetworkResource redirectCandidate = redirectCandidates.get(i);
        if (redirectCandidate.getUrl().equals(url)) {
            // Should not be a concurrent modification, since we now bail out of
            // the loop right after mutating the queue.
            redirectCandidates.splice(i, 1);
            return redirectCandidate;
        }
    }

    return null;
}