本文整理匯總了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);
}