All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.samples.java.ex.ITC_Sample Maven / Gradle / Ivy

Go to download

An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.

The newest version!
package ex;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;

@SuppressWarnings("all")
public class ITC_Sample {
    class A {

    }

    class B extends A {
    }

    class C extends A {
    }

    public String testOthers(List l) {
        if (l instanceof ArrayList)
            return (String) ((ArrayList) l).remove(0);
        else if (l instanceof LinkedList)
            return (String) ((LinkedList) l).removeFirst();
        else if (l instanceof Vector)
            return (String) ((Vector) l).remove(0);
        else
            return null;
    }

    public String testMine(A a) {
        if (a instanceof B)
            return "Yes";
        else if (a instanceof C)
            return "No";
        else
            return "Unknown";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy