Skip to main content

In Java 8 you can have default implementations in interface but I believe that will not solve your problem. Instead of changing the method signatures you can create a separate static method and call it with the class name within getUsers implementation. e.g.

createCreate new method: public static Collection<IUserEntity> getUsersStatic() { return staticUserEntityMap.values(); }

public static Collection<IUserEntity> getUsersStatic() { return staticUserEntityMap.values(); } 

callCall this method from getUsers: public Collection<IUserEntity> getUsers() { return UserEntity.getUsersStatic(); }:

public Collection<IUserEntity> getUsers() { return UserEntity.getUsersStatic(); } 

In Java 8 you can have default implementations in interface but I believe that will not solve your problem. Instead of changing the method signatures you can create a separate static method and call it with the class name within getUsers implementation. e.g.

create new method: public static Collection<IUserEntity> getUsersStatic() { return staticUserEntityMap.values(); }

call this method from getUsers: public Collection<IUserEntity> getUsers() { return UserEntity.getUsersStatic(); }

In Java 8 you can have default implementations in interface but I believe that will not solve your problem. Instead of changing the method signatures you can create a separate static method and call it with the class name within getUsers implementation. e.g.

Create new method:

public static Collection<IUserEntity> getUsersStatic() { return staticUserEntityMap.values(); } 

Call this method from getUsers:

public Collection<IUserEntity> getUsers() { return UserEntity.getUsersStatic(); } 
Source Link
Riaz
  • 94
  • 5

In Java 8 you can have default implementations in interface but I believe that will not solve your problem. Instead of changing the method signatures you can create a separate static method and call it with the class name within getUsers implementation. e.g.

create new method: public static Collection<IUserEntity> getUsersStatic() { return staticUserEntityMap.values(); }

call this method from getUsers: public Collection<IUserEntity> getUsers() { return UserEntity.getUsersStatic(); }