Skip to main content
formatting and removing useless stuff
Source Link
Caleb Kleveter
  • 11.6k
  • 8
  • 68
  • 94

I Have a UserEntity class which implements the IUserEntity interface.

In the UserEntity class I have a static map  :

private static Map<IUserEntity.IIdentifiable, IUserEntity> staticUserEntityMap = new HashMap<>(); 

In the IUserEntity interface I would like to write a method like that  :

public Collection<IUserEntity> getUsers(); 

And in the class :

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

But I can't declare static methods in the interface and I can't change the method signature in the UserEntity class.

How can iI do this ?

I Have a UserEntity class which implements the IUserEntity interface.

In the UserEntity class I have a static map  :

private static Map<IUserEntity.IIdentifiable, IUserEntity> staticUserEntityMap = new HashMap<>(); 

In the IUserEntity interface I would like to write a method like that  :

public Collection<IUserEntity> getUsers(); 

And in the class :

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

But I can't declare static methods in the interface and I can't change the method signature in the UserEntity class.

How can i do this ?

I Have a UserEntity class which implements the IUserEntity interface.

In the UserEntity class I have a static map:

private static Map<IUserEntity.IIdentifiable, IUserEntity> staticUserEntityMap = new HashMap<>(); 

In the IUserEntity interface I would like to write a method like that:

public Collection<IUserEntity> getUsers(); 

And in the class :

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

But I can't declare static methods in the interface and I can't change the method signature in the UserEntity class.

How can I do this ?

I please someone to tell me how I can do this... u___u

I Have a UserEntity ClassUserEntity class which implements the IUserEntityIUserEntity interface.

In the UserEntity ClassUserEntity class I have a static map :

private static Map<IUserEntity.IIdentifiable, IUserEntity> staticUserEntityMap = new HashMap<>(); 

In the IUserEntityIUserEntity interface I would like to write a method like that :

public Collection<IUserEntity> getUsers(); 

InAnd in the class :

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

But I cant implementscan't declare static methods in the Interfaceinterface and I cantcan't change the method signature in the UserEntity ClassUserEntity class.

How can i do this ?

Thanks for your help !

I please someone to tell me how I can do this... u___u

I Have a UserEntity Class which implements the IUserEntity interface

In the UserEntity Class I have a static map :

private static Map<IUserEntity.IIdentifiable, IUserEntity> staticUserEntityMap = new HashMap<>(); 

In the IUserEntity interface I would like to write method like that :

public Collection<IUserEntity> getUsers(); 

In the class :

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

But I cant implements static methods in the Interface and I cant change the method signature in the UserEntity Class.

How can i do this ?

Thanks for your help !

I Have a UserEntity class which implements the IUserEntity interface.

In the UserEntity class I have a static map :

private static Map<IUserEntity.IIdentifiable, IUserEntity> staticUserEntityMap = new HashMap<>(); 

In the IUserEntity interface I would like to write a method like that :

public Collection<IUserEntity> getUsers(); 

And in the class :

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

But I can't declare static methods in the interface and I can't change the method signature in the UserEntity class.

How can i do this ?

Source Link

Static methods and interfaces in Java

I please someone to tell me how I can do this... u___u

I Have a UserEntity Class which implements the IUserEntity interface

In the UserEntity Class I have a static map :

private static Map<IUserEntity.IIdentifiable, IUserEntity> staticUserEntityMap = new HashMap<>(); 

In the IUserEntity interface I would like to write method like that :

public Collection<IUserEntity> getUsers(); 

In the class :

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

But I cant implements static methods in the Interface and I cant change the method signature in the UserEntity Class.

How can i do this ?

Thanks for your help !