本文整理汇总了Java中java.util.NavigableMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java NavigableMap.size方法的具体用法?Java NavigableMap.size怎么用?Java NavigableMap.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.NavigableMap
的用法示例。
在下文中一共展示了NavigableMap.size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetFlag
import java.util.NavigableMap; //导入方法依赖的package包/类
public void testSetFlag() throws Exception
{
NavigableMap<Long, FileInfo> fis = imapService.getFolderStatus(authenticationService.getCurrentUserName(), testImapFolderNodeRef, ImapViewMode.ARCHIVE).search;
if (fis != null && fis.size() > 0)
{
FileInfo messageFileInfo = fis.firstEntry().getValue();
reauthenticate(USER_NAME, USER_PASSWORD);
permissionService.setPermission(testImapFolderNodeRef, anotherUserName, PermissionService.WRITE, true);
reauthenticate(anotherUserName, anotherUserName);
imapService.setFlag(messageFileInfo, Flags.Flag.RECENT, true);
Serializable prop = nodeService.getProperty(messageFileInfo.getNodeRef(), ImapModel.PROP_FLAG_RECENT);
assertNotNull("Can't set RECENT flag", prop);
}
}
示例2: testGetFlags
import java.util.NavigableMap; //导入方法依赖的package包/类
public void testGetFlags() throws Exception
{
NavigableMap<Long, FileInfo> fis = imapService.getFolderStatus(authenticationService.getCurrentUserName(), testImapFolderNodeRef, ImapViewMode.ARCHIVE).search;
if (fis != null && fis.size() > 0)
{
FileInfo messageFileInfo = fis.firstEntry().getValue();
reauthenticate(USER_NAME, USER_PASSWORD);
permissionService.setPermission(testImapFolderNodeRef, anotherUserName, PermissionService.WRITE, true);
imapService.setFlags(messageFileInfo, flags, true);
reauthenticate(anotherUserName, anotherUserName);
Flags fl = imapService.getFlags(messageFileInfo);
assertTrue(fl.contains(flags));
}
}
示例3: mutateMap
import java.util.NavigableMap; //导入方法依赖的package包/类
void mutateMap(NavigableMap<Integer, Integer> map, int min, int max) {
int size = map.size();
int rangeSize = max - min + 1;
// Remove a bunch of entries directly
for (int i = 0, n = rangeSize / 2; i < n; i++) {
remove(map, min - 5 + rnd.nextInt(rangeSize + 10));
}
// Remove a bunch of entries with iterator
for (Iterator<Integer> it = map.keySet().iterator(); it.hasNext(); ) {
if (rnd.nextBoolean()) {
bs.clear(it.next());
it.remove();
}
}
// Add entries till we're back to original size
while (map.size() < size) {
int key = min + rnd.nextInt(rangeSize);
assertTrue(key >= min && key <= max);
put(map, key);
}
}
示例4: readOlderScopes
import java.util.NavigableMap; //导入方法依赖的package包/类
public void readOlderScopes(NavigableMap<byte[], Integer> scopes) {
if (scopes != null) {
Iterator<Map.Entry<byte[], Integer>> iterator = scopes.entrySet()
.iterator();
while (iterator.hasNext()) {
Map.Entry<byte[], Integer> scope = iterator.next();
String key = Bytes.toString(scope.getKey());
if (key.startsWith(PREFIX_CLUSTER_KEY)) {
addClusterId(UUID.fromString(key.substring(PREFIX_CLUSTER_KEY
.length())));
iterator.remove();
}
}
if (scopes.size() > 0) {
this.scopes = scopes;
}
}
}
示例5: testSetFlags
import java.util.NavigableMap; //导入方法依赖的package包/类
public void testSetFlags() throws Exception
{
NavigableMap<Long, FileInfo> fis = imapService.getFolderStatus(authenticationService.getCurrentUserName(), testImapFolderNodeRef, ImapViewMode.ARCHIVE).search;
if (fis != null && fis.size() > 0)
{
FileInfo messageFileInfo = fis.firstEntry().getValue();
try
{
setFlags(messageFileInfo);
fail("Can't set flags");
}
catch (Exception e)
{
if (e instanceof AccessDeniedException)
{
// expected
}
else
{
throw e;
}
}
reauthenticate(USER_NAME, USER_PASSWORD);
permissionService.setPermission(testImapFolderNodeRef, anotherUserName, PermissionService.WRITE, true);
reauthenticate(anotherUserName, anotherUserName);
setFlags(messageFileInfo);
}
}
示例6: mutateSubMap
import java.util.NavigableMap; //导入方法依赖的package包/类
void mutateSubMap(NavigableMap<Integer, Integer> map, int min, int max) {
int size = map.size();
int rangeSize = max - min + 1;
// Remove a bunch of entries directly
for (int i = 0, n = rangeSize / 2; i < n; i++) {
remove(map, min - 5 + rnd.nextInt(rangeSize + 10));
}
// Remove a bunch of entries with iterator
for (Iterator<Integer> it = map.keySet().iterator(); it.hasNext(); ) {
if (rnd.nextBoolean()) {
bs.clear(it.next());
it.remove();
}
}
// Add entries till we're back to original size
while (map.size() < size) {
int key = min - 5 + rnd.nextInt(rangeSize + 10);
if (key >= min && key <= max) {
put(map, key);
} else {
try {
map.put(key, 2 * key);
shouldThrow();
} catch (IllegalArgumentException success) {}
}
}
}
示例7: getAllRegionLocations
import java.util.NavigableMap; //导入方法依赖的package包/类
@Override
public List<HRegionLocation> getAllRegionLocations() throws IOException {
NavigableMap<HRegionInfo, ServerName> locations =
MetaScanner.allTableRegions(this.connection, getName());
ArrayList<HRegionLocation> regions = new ArrayList<>(locations.size());
for (Entry<HRegionInfo, ServerName> entry : locations.entrySet()) {
regions.add(new HRegionLocation(entry.getKey(), entry.getValue()));
}
return regions;
}
示例8: removeMatchingKeys
import java.util.NavigableMap; //导入方法依赖的package包/类
private boolean removeMatchingKeys(NavigableMap<Endpoint, Integer> map, Endpoint endpoint, Map<UUID, TreeMap<Endpoint, Integer>> otherMap, Direction dir) {
if (map == null) {
return false;
}
// Mark this endpoint as a marker, because it is used to do a tailMap traversal to remove matching edges
endpoint.setMarker();
// Find the first key
Endpoint floorKey = map.floorKey(endpoint);
Map<Endpoint, Integer> view;
if (floorKey == null) {
// This means that the element being searched is the minimum
view = map;
} else {
view = map.tailMap(floorKey);
}
Iterator<Map.Entry<Endpoint, Integer>> entryIter = view.entrySet().iterator();
boolean isFirst = true;
while (entryIter.hasNext()) {
Map.Entry<Endpoint, Integer> entry = entryIter.next();
Endpoint key = entry.getKey();
if (endpoint.isMatch(key)) {
// Remove it from this index
entryIter.remove();
// and from the underlying edge map if necessary
if (dir != null) { // Direction is null if this is a recursive all
// Remove the edge if the map is provided for this purpose
UUID edgeId = key.getEdgeId();
IEdge edge = edgeRemover.removeEdge(edgeId);
assert (edge != null);
// Remove the other endpoint of this edge. NOTE: Self loops are not allowed.
Endpoint otherEndpoint;
UUID otherVertexId;
if (dir == Direction.OUT) {
otherVertexId = edge.getInVertexId();
otherEndpoint = new Endpoint(key.getEdgeLabel(), key.getEdgeId());
} else {
otherVertexId = edge.getOutVertexId();
otherEndpoint = new Endpoint(key.getEdgeLabel(), key.getEdgeId());
}
if (removeMatchingKeys(otherMap.get(otherVertexId), otherEndpoint, null, null)) {
otherMap.remove(otherVertexId);
}
}
} else {
// Done with removes -- the tree map is sorted
if (isFirst) {
// continue
} else {
break;
}
}
isFirst = false;
}
return (map.size() == 0);
}