Back to project page RealtimeMessaging-Android.
The source code is released under:
MIT License
If you think the Android project RealtimeMessaging-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ibt.ortc.extensibility; /*from w w w . java 2 s . c o m*/ import java.util.HashMap; class DispatchedMessages { private static final int LIMIT = 1024; private int currentIdx; private String[] ids; private HashMap<String, Integer> hMap; public DispatchedMessages(){ this.currentIdx = 0; this.ids = new String[LIMIT]; this.hMap = new HashMap<String, Integer>(); } protected void addMessageId(String messageId){ currentIdx++; if(currentIdx>=LIMIT) currentIdx = 0; if(ids[currentIdx] != null){ hMap.remove(ids[currentIdx]); } hMap.put(messageId, currentIdx); ids[currentIdx] = messageId; } protected boolean checkIfDispatched(String messageId){ return hMap.containsKey(messageId); } }