int max = providers.size(); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName() == provider .getName()) return -1;
int max = providers.size (); for (int i = 0; i < max; i++) { if (((Provider) providers.elementAt(i)).getName().equals(provider.getName())) return -1;
    public static int insertProviderAt(Provider provider, int position) {        SecurityManager sm = System.getSecurityManager();        if (sm != null)                sm.checkSecurityAccess("insertProvider." + provider.getName());        position--;        int max = providers.size();        for (int i = 0; i < max; i++) {            if (((Provider) providers.elementAt(i)).getName() == provider                    .getName()) return -1;        }        if (position < 0) position = 0;        if (position > max) position = max;        providers.insertElementAt(provider, position);        return position + 1;    }