-1

I want to loop through all entries of AbstractMap.SimpleEntry type and Map type using the same function. Is there a way to do it?

Debra
  • 39
  • 5

1 Answers1

0

You cannot iterate through what you are asking. I am guessing you mean the following:

for(Map.Entry<K, V> entry : AbstractMap.entrySet()) {
   K key = entry.getKey();
   V value = entry.getValue();
}

This example will not run; you'll need to alter it to your concrete implementations of the Abstract classes and Key/Value definitions.

Oracle Java Docs

Another Example

mhradek
  • 1,376
  • 14
  • 19
  • Yes Its AbstractMap.SimpleEntry object. Yes you are right. I want to loop through (AbstractMap.SimpleEntry object and check each entry. I basically want to serialize it. So what should I do? – Debra Sep 21 '17 at 09:39