You need to sign in to do that
Don't have an account?

Create a List without repeating elements
Hello,
I have a List of Objects, for example:
myList = (Object1, Object2 , Object3, Object4)
where:
Object1.Name = 'NameA',
Object2.Name = 'NameB',
Object3.Name = 'NameA' and
Object4.Name='NameC'
I have to create a List of Names without repeated Names, and also I need a List that counts the number of the elements, in this example:
NonRepeatedNamesList = ('NameA','NameB','NameC');
CounterList = (2,1,1);
Can anybody help me please?
I have a List of Objects, for example:
myList = (Object1, Object2 , Object3, Object4)
where:
Object1.Name = 'NameA',
Object2.Name = 'NameB',
Object3.Name = 'NameA' and
Object4.Name='NameC'
I have to create a List of Names without repeated Names, and also I need a List that counts the number of the elements, in this example:
NonRepeatedNamesList = ('NameA','NameB','NameC');
CounterList = (2,1,1);
Can anybody help me please?
The code has the following error:
Method does not exist or incorrect signature: void contains(String) from the type Map<String,Integer>
The issue is coming because I´m using String method with Set. So I use the solution below:
All Answers
Aratz Guerra
try this i hope this solve your problem
The code has the following error:
Method does not exist or incorrect signature: void contains(String) from the type Map<String,Integer>
The issue is coming because I´m using String method with Set. So I use the solution below: