Java interface design

Posted by Nayn on Stack Overflow See other posts from Stack Overflow or by Nayn
Published on 2010-06-02T01:06:07Z Indexed on 2010/06/02 1:14 UTC
Read the original article Hit count: 250

Filed under:

Hi, I had an interface initially as below.

public interface testMe {
      public Set<String> doSomething();
}
public class A implements testMe {
      public Set<String> doSomething() {
           return // Set<String>
      }
}

I had similar classes implementing testMe. Now I have to add one more class which returns Set<Some Object>

public class X implements testMe() {
     public Set<Some OBject> doSomething() {
     }
}

How could i add this mehtod in the interface without breaking existing classes? Thanks Nayn

© Stack Overflow or respective owner

Related posts about java