[vlma-devel] commit: Iterate over Map.entrySet rather than Map.keySet. (Adrien Grand )

git version control git at videolan.org
Sat Aug 2 18:53:24 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Aug  2 18:50:27 2008 +0200| [47b2b59348c7b232076e8bb477a14bbd0fcac2c4] | committer: Adrien Grand 

Iterate over Map.entrySet rather than Map.keySet.

(It prevents from doing lookups to get the entry value.)

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=47b2b59348c7b232076e8bb477a14bbd0fcac2c4
---

 .../java/org/videolan/vlma/OrderGiverImpl.java     |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/OrderGiverImpl.java b/vlma-core/src/main/java/org/videolan/vlma/OrderGiverImpl.java
index 4fe02f9..d299100 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/OrderGiverImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/OrderGiverImpl.java
@@ -27,6 +27,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
@@ -122,17 +123,17 @@ public class OrderGiverImpl implements OrderGiver {
                 Program p = m.getProgram();
                 if (p != null && p.isTimeToPlay()) {
                     logger.log(Level.DEBUG, "Media to be streamed: " + m.getName());
-                    for (Integer h : readyAdapters.keySet()) {
-                        List<Adapter> sameHashTypeAdapterList = readyAdapters.get(h);
+                    for (Entry<Integer, List<Adapter>> adapters : readyAdapters.entrySet()) {
+                        List<Adapter> sameHashTypeAdapterList = adapters.getValue();
                         // If the first adapter of the list can read the
                         // media, then
                         if (sameHashTypeAdapterList.get(0).canRead(m)) {
                             // Get or create the VLMediaGroup list of this
                             // type of media
-                            List<MediaGroup> sameHashTypeGroupList = programGroups.get(h);
+                            List<MediaGroup> sameHashTypeGroupList = programGroups.get(adapters.getKey());
                             if (sameHashTypeGroupList == null) {
                                 sameHashTypeGroupList = new ArrayList<MediaGroup>();
-                                programGroups.put(h, sameHashTypeGroupList);
+                                programGroups.put(adapters.getKey(), sameHashTypeGroupList);
                             }
 
                             // Inside the the MediaGroup list, get the



More information about the vlma-devel mailing list