本文整理汇总了Java中java.util.TreeMap.remove方法的典型用法代码示例。如果您正苦于以下问题:Java TreeMap.remove方法的具体用法?Java TreeMap.remove怎么用?Java TreeMap.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.TreeMap
的用法示例。
在下文中一共展示了TreeMap.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPollLastEntry
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* pollLastEntry returns entries in order
*/
public void testPollLastEntry() {
TreeMap map = map5();
Map.Entry e = map.pollLastEntry();
assertEquals(five, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(four, e.getKey());
map.put(five, "E");
e = map.pollLastEntry();
assertEquals(five, e.getKey());
assertEquals("E", e.getValue());
e = map.pollLastEntry();
assertEquals(three, e.getKey());
map.remove(two);
e = map.pollLastEntry();
assertEquals(one, e.getKey());
try {
e.setValue("E");
shouldThrow();
} catch (UnsupportedOperationException success) {}
e = map.pollLastEntry();
assertNull(e);
}
示例2: UploadCdnEntity
import java.util.TreeMap; //导入方法依赖的package包/类
public String UploadCdnEntity(TreeMap<String, Object> params) throws NoSuchAlgorithmException, IOException {
String actionName = "UploadCdnEntity";
String entityFile = params.get("entityFile").toString();
params.remove("entityFile");
File file = new File(entityFile);
if (!file.exists()) {
throw new FileNotFoundException();
}
if (!params.containsKey("entityFileMd5")) {
params.put("entityFileMd5", MD5.fileNameToMD5(entityFile));
}
return call(actionName, params, entityFile);
}
示例3: MultipartUploadVodFile
import java.util.TreeMap; //导入方法依赖的package包/类
public String MultipartUploadVodFile(TreeMap<String, Object> params) throws NoSuchAlgorithmException, IOException {
serverHost = "vod.qcloud.com";
String actionName = "MultipartUploadVodFile";
String fileName = params.get("file").toString();
params.remove("file");
File f= new File(fileName);
if (!params.containsKey("fileSize")){
params.put("fileSize", f.length());
}
if (!params.containsKey("fileSha")){
params.put("fileSha", SHA1.fileNameToSHA(fileName));
}
return call(actionName, params, fileName);
}
示例4: rearrangeGroupColumns
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* Rearrange group columns.
*
* @param groupSelectionMap
* the group selection map
*/
public void rearrangeGroupColumns(TreeMap<Integer, List<List<Integer>>> groupSelectionMap){
Map<Integer, List<List<Integer>>> tempMap = new TreeMap<Integer, List<List<Integer>>>(groupSelectionMap);
for(int key:tempMap.keySet()){
List<List<Integer>> groups = tempMap.get(key);
List<Integer> tempList=new ArrayList<>();
for (List<Integer> grp : groups) {
tempList.addAll(grp);
}
if(tempList.isEmpty()){
for(int i=key ;i<tempMap.size()-1;i++){
groupSelectionMap.put(i, tempMap.get(i+1));
}
groupSelectionMap.remove(groupSelectionMap.lastKey());
}
}
}
示例5: testPollFirstEntry
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* pollFirstEntry returns entries in order
*/
public void testPollFirstEntry() {
TreeMap map = map5();
Map.Entry e = map.pollFirstEntry();
assertEquals(one, e.getKey());
assertEquals("A", e.getValue());
e = map.pollFirstEntry();
assertEquals(two, e.getKey());
map.put(one, "A");
e = map.pollFirstEntry();
assertEquals(one, e.getKey());
assertEquals("A", e.getValue());
e = map.pollFirstEntry();
assertEquals(three, e.getKey());
map.remove(four);
e = map.pollFirstEntry();
assertEquals(five, e.getKey());
try {
e.setValue("A");
shouldThrow();
} catch (UnsupportedOperationException success) {}
e = map.pollFirstEntry();
assertNull(e);
}
示例6: getBuffer
import java.util.TreeMap; //导入方法依赖的package包/类
@Override
public synchronized ByteBuffer getBuffer(boolean direct, int length) {
TreeMap<Key, ByteBuffer> tree = getBufferTree(direct);
Map.Entry<Key, ByteBuffer> entry =
tree.ceilingEntry(new Key(length, 0));
if (entry == null) {
return direct ? ByteBuffer.allocateDirect(length) :
ByteBuffer.allocate(length);
}
tree.remove(entry.getKey());
return entry.getValue();
}
示例7: deleteIslandFromCache
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* Deletes an island from the database. Does not remove blocks
* @param island
*/
public void deleteIslandFromCache(Island island) {
if (!islandsByLocation.remove(island.getCenter(), island)) {
plugin.getLogger().severe("Could not remove island from cache!");
}
Iterator<Entry<UUID, Island>> it = islandsByUUID.entrySet().iterator();
while (it.hasNext()) {
Entry<UUID, Island> en = it.next();
if (en.getValue().equals(island)) {
it.remove();
}
}
// Remove from grid
if (DEBUG)
plugin.getLogger().info("DEBUG: deleting island at " + island.getCenter());
if (island != null) {
int x = island.getMinX();
int z = island.getMinZ();
if (DEBUG)
plugin.getLogger().info("DEBUG: x = " + x + " z = " + z);
if (islandGrid.containsKey(x)) {
if (DEBUG)
plugin.getLogger().info("DEBUG: x found");
TreeMap<Integer, Island> zEntry = islandGrid.get(x);
if (zEntry.containsKey(z)) {
if (DEBUG)
plugin.getLogger().info("DEBUG: z found - deleting the island");
// Island exists - delete it
zEntry.remove(z);
islandGrid.put(x, zEntry);
} else {
if (DEBUG)
plugin.getLogger().info("DEBUG: could not find z");
}
}
}
}
示例8: testRemove1_NullPointerException
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* remove(null) throws NPE for nonempty map
*/
public void testRemove1_NullPointerException() {
TreeMap c = new TreeMap();
c.put("sadsdf", "asdads");
try {
c.remove(null);
shouldThrow();
} catch (NullPointerException success) {}
}
示例9: getFileUploadProcessors
import java.util.TreeMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected List<FileUploadProcessor> getFileUploadProcessors(String group) throws Exception {
// 初始化业务分支
if (initdTag.compareAndSet(false, true)) {
TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> all =
(TreeMap<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>>) fileProcessFactory.getObject();
//
TreeMap<Integer, LinkedList<FileUploadProcessor>> pd = all.get(AbstractChannelProcessor.KEY);
for (Entry<Integer, LinkedList<FileUploadProcessor>> orderProcessorEntry : pd.entrySet()) {
publicChannel.addAll(orderProcessorEntry.getValue());
}
all.remove(AbstractChannelProcessor.KEY);//干掉主分支
// 遍历其他的树
for (Entry<String, TreeMap<Integer, LinkedList<FileUploadProcessor>>> tree : all.entrySet()) {
TreeMap<Integer, LinkedList<FileUploadProcessor>> thisTree = tree.getValue();
LinkedList<FileUploadProcessor> thisTreeList = new LinkedList<FileUploadProcessor>();
// 添加树枝
for (Entry<Integer, LinkedList<FileUploadProcessor>> branch : thisTree.entrySet()) {
thisTreeList.addAll(branch.getValue());
}
for (int i = 0; i < thisTreeList.size()-1; i++) {
((AbstractChannelProcessor)thisTreeList.get(i)).nextProcessor = thisTreeList.get(i+1);
}
namedChannel.put(tree.getKey(), thisTreeList);
}
}
//
if (StringUtils.isBlank(group)) {
return publicChannel;
} else {
LinkedList<FileUploadProcessor> ppl = namedChannel.get(group);
return ppl == null ? new LinkedList<FileUploadProcessor>() : ppl;
}
}
示例10: removeEventListener
import java.util.TreeMap; //导入方法依赖的package包/类
public static void removeEventListener(String eventType,
IEventListener listener) {
TreeMap<String, IEventListener> listenerMap = listenersMap
.get(eventType);
if (listenerMap != null) {
listenerMap.remove(createKey(listener));
if (listenerMap.size() == 0) {
listenersMap.remove(eventType);
}
}
}
示例11: removeEvictable
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* Remove a replica from an evictable map.
*
* @param replica The replica to remove.
* @param map The map to remove it from.
*/
private void removeEvictable(ShortCircuitReplica replica,
TreeMap<Long, ShortCircuitReplica> map) {
Long evictableTimeNs = replica.getEvictableTimeNs();
Preconditions.checkNotNull(evictableTimeNs);
ShortCircuitReplica removed = map.remove(evictableTimeNs);
Preconditions.checkState(removed == replica,
"failed to make %s unevictable", replica);
replica.setEvictableTimeNs(null);
}
示例12: FriendsListRecycler
import java.util.TreeMap; //导入方法依赖的package包/类
public FriendsListRecycler(FragmentActivity context) {
this.mContext = context;
// remove self and display all others
TreeMap<String, User> tempHashMap = new TreeMap<>(UserHelper.getInstance().getAllContacts());
tempHashMap.remove(UserHelper.getInstance().getOwnerProfile().username);
mUserList = new ArrayList<>(tempHashMap.values());
}
示例13: notifyDataSetHasChanged
import java.util.TreeMap; //导入方法依赖的package包/类
public void notifyDataSetHasChanged() {
TreeMap<String, User> tempHashMap = new TreeMap<>(UserHelper.getInstance().getAllContacts());
tempHashMap.remove(UserHelper.getInstance().getOwnerProfile().username);
mUserList = new ArrayList<>(tempHashMap.values());
super.notifyDataSetChanged();
}
示例14: testRemove
import java.util.TreeMap; //导入方法依赖的package包/类
/**
* remove removes the correct key-value pair from the map
*/
public void testRemove() {
TreeMap map = map5();
map.remove(five);
assertEquals(4, map.size());
assertFalse(map.containsKey(five));
}
示例15: removeColumnFromMap
import java.util.TreeMap; //导入方法依赖的package包/类
private void removeColumnFromMap(TreeMap<byte[], TreeSet<byte[]>> map, byte[] family,
byte[] qualifier) {
TreeSet<byte[]> set = map.get(family);
set.remove(qualifier);
if (set.isEmpty()) map.remove(family);
}