当前位置: 首页>>代码示例>>Java>>正文


Java SortedSet.addAll方法代码示例

本文整理汇总了Java中java.util.SortedSet.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java SortedSet.addAll方法的具体用法?Java SortedSet.addAll怎么用?Java SortedSet.addAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.SortedSet的用法示例。


在下文中一共展示了SortedSet.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deepCopy

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Performs a deep copy of the supplied {@link Map} such that the
 * {@link SortedMap} returned has copies of the supplied {@link
 * Map}'s {@linkplain Map#values() values}.
 *
 * <p>This method may return {@code null} if {@code source} is
 * {@code null}.</p>
 *
 * <p>The {@link SortedMap} returned by this method is
 * mutable.</p>
 *
 * @param source the {@link Map} to copy; may be {@code null} in
 * which case {@code null} will be returned
 *
 * @return a mutable {@link SortedMap}, or {@code null}
 */
private static final SortedMap<String, SortedSet<Entry>> deepCopy(final Map<? extends String, ? extends SortedSet<Entry>> source) {
  final SortedMap<String, SortedSet<Entry>> returnValue;
  if (source == null) {
    returnValue = null;
  } else if (source.isEmpty()) {
    returnValue = Collections.emptySortedMap();
  } else {
    returnValue = new TreeMap<>();
    final Collection<? extends Map.Entry<? extends String, ? extends SortedSet<Entry>>> entrySet = source.entrySet();
    if (entrySet != null && !entrySet.isEmpty()) {
      for (final Map.Entry<? extends String, ? extends SortedSet<Entry>> entry : entrySet) {
        final String key = entry.getKey();
        final SortedSet<Entry> value = entry.getValue();
        if (value == null) {
          returnValue.put(key, null);
        } else {
          final SortedSet<Entry> newValue = new TreeSet<>(value.comparator());
          newValue.addAll(value);
          returnValue.put(key, newValue);
        }
      }
    }
  }
  return returnValue;
}
 
开发者ID:microbean,项目名称:microbean-helm,代码行数:42,代码来源:ChartRepository.java

示例2: getAllTokens

import java.util.SortedSet; //导入方法依赖的package包/类
String[] getAllTokens() {
    if (allTokens == null) {
        try {
            SortedSet<String> provTokens = new TreeSet<String>();
            provTokens.addAll(Arrays.asList(IDE_TOKENS));
            for (ModuleEntry me : getModuleList().getAllEntries()) {
                provTokens.addAll(Arrays.asList(me.getProvidedTokens()));
            }
            String[] result = new String[provTokens.size()];
            return provTokens.toArray(result);
        } catch (IOException e) {
            allTokens = new String[0];
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    return allTokens;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:SingleModuleProperties.java

示例3: removeAnswer

import java.util.SortedSet; //导入方法依赖的package包/类
/**
    * Ajax call, remove the given answer.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward removeAnswer(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

SortedSet<ScratchieAnswer> answerList = getAnswersFromRequest(request, false);

int answerIndex = NumberUtils.toInt(request.getParameter(ScratchieConstants.PARAM_ANSWER_INDEX), -1);
if (answerIndex != -1) {
    List<ScratchieAnswer> rList = new ArrayList<ScratchieAnswer>(answerList);
    rList.remove(answerIndex);
    answerList.clear();
    answerList.addAll(rList);
}

request.setAttribute(ScratchieConstants.ATTR_ANSWER_LIST, answerList);
request.setAttribute(AttributeNames.PARAM_CONTENT_FOLDER_ID,
	WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID));
return mapping.findForward(ScratchieConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:AuthoringAction.java

示例4: refreshJavaPlatforms

import java.util.SortedSet; //导入方法依赖的package包/类
private void refreshJavaPlatforms() {
    SortedSet<JavaPlatform> platforms = new TreeSet<JavaPlatform>(new Comparator<JavaPlatform>() {
        Collator COLL = Collator.getInstance();
        public int compare(JavaPlatform p1, JavaPlatform p2) {
            int res = COLL.compare(p1.getDisplayName(), p2.getDisplayName());
            if (res != 0) {
                return res;
            } else {
                return System.identityHashCode(p1) - System.identityHashCode(p2);
            }
        }
    });
    platforms.addAll(Arrays.asList(JavaPlatformManager.getDefault().getInstalledPlatforms()));
    javaPlatform.setModel(new DefaultComboBoxModel(platforms.toArray(new JavaPlatform[platforms.size()])));
    JavaPlatform pf = jdkConf.getSelectedPlatform();
    if (pf == null) {
        pf = JavaPlatformManager.getDefault().getDefaultPlatform();
    }
    javaPlatform.setSelectedItem(pf);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ClasspathPanel.java

示例5: removeQuestion

import java.util.SortedSet; //导入方法依赖的package包/类
/**
    * Remove daco question from HttpSession list and update page display. As authoring rule, all persist only happen
    * when user
    * submit whole page. So this remove is just impact HttpSession values.
    * 
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   protected ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request) {

// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, DacoConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);

int questionIndex = NumberUtils.stringToInt(request.getParameter(DacoConstants.PARAM_QUESTION_INDEX), -1);
if (questionIndex != -1) {
    SortedSet<DacoQuestion> questionSet = getQuestionList(sessionMap);
    List<DacoQuestion> questionList = new ArrayList<DacoQuestion>(questionSet);
    DacoQuestion question = questionList.remove(questionIndex);
    questionSet.clear();
    questionSet.addAll(questionList);
    // add to delList
    List deletedList = getDeletedDacoQuestionList(sessionMap);
    deletedList.add(question);
}

request.setAttribute(DacoConstants.ATTR_SESSION_MAP_ID, sessionMapID);
return mapping.findForward(DacoConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:AuthoringAction.java

示例6: removeItem

import java.util.SortedSet; //导入方法依赖的package包/类
/**
    * Ajax call, remove the given line of instruction of resource item.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward removeItem(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

String sessionMapID = WebUtil.readStrParam(request, ScratchieConstants.ATTR_SESSION_MAP_ID);
request.setAttribute(ScratchieConstants.ATTR_SESSION_MAP_ID, sessionMapID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);
SortedSet<ScratchieItem> itemList = getItemList(sessionMap);

int itemIndex = NumberUtils.toInt(request.getParameter(ScratchieConstants.PARAM_ITEM_INDEX), -1);
if (itemIndex != -1) {
    List<ScratchieItem> rList = new ArrayList<ScratchieItem>(itemList);
    ScratchieItem item = rList.remove(itemIndex);
    itemList.clear();
    itemList.addAll(rList);

    // add to delList
    List<ScratchieItem> delList = getDeletedItemList(sessionMap);
    delList.add(item);
}

request.setAttribute(ScratchieConstants.ATTR_ITEM_LIST, itemList);
return mapping.findForward(ScratchieConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:AuthoringAction.java

示例7: allPartitionsSorted

import java.util.SortedSet; //导入方法依赖的package包/类
public List<TopicPartition> allPartitionsSorted(Map<String, Integer> partitionsPerTopic,
                                                Map<String, Subscription> subscriptions) {
    SortedSet<String> topics = new TreeSet<>();
    for (Subscription subscription : subscriptions.values())
        topics.addAll(subscription.topics());

    List<TopicPartition> allPartitions = new ArrayList<>();
    for (String topic : topics) {
        Integer numPartitionsForTopic = partitionsPerTopic.get(topic);
        if (numPartitionsForTopic != null)
            allPartitions.addAll(AbstractPartitionAssignor.partitions(topic, numPartitionsForTopic));
    }
    return allPartitions;
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:15,代码来源:RoundRobinAssignor.java

示例8: switchItem

import java.util.SortedSet; //导入方法依赖的package包/类
private ActionForward switchItem(ActionMapping mapping, HttpServletRequest request, boolean up) {
// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, KalturaConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID);
request.setAttribute(KalturaConstants.ATTR_SESSION_MAP_ID, sessionMapID);

int itemIdx = NumberUtils.stringToInt(request.getParameter(KalturaConstants.PARAM_ITEM_INDEX), -1);
if (itemIdx != -1) {
    SortedSet<KalturaItem> kalturaList = getItemList(sessionMap);
    List<KalturaItem> rList = new ArrayList<KalturaItem>(kalturaList);
    // get current and the target item, and switch their sequnece
    KalturaItem item = rList.get(itemIdx);
    KalturaItem repItem;
    if (up) {
	repItem = rList.get(--itemIdx);
    } else {
	repItem = rList.get(++itemIdx);
    }
    int upSeqId = repItem.getSequenceId();
    repItem.setSequenceId(item.getSequenceId());
    item.setSequenceId(upSeqId);

    // put back list, it will be sorted again
    kalturaList.clear();
    kalturaList.addAll(rList);
}

return mapping.findForward(KalturaConstants.ITEM_LIST);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:AuthoringAction.java

示例9: deregisterServiceProvider

import java.util.SortedSet; //导入方法依赖的package包/类
public static void deregisterServiceProvider(final String serviceProviderId)
{
    synchronized(serviceProviders)
    {
        final ServiceProvider deregisteredServiceProvider =
            serviceProviders.remove(serviceProviderIdentifier(serviceProviderId));

        if (deregisteredServiceProvider != null)
        {
            final SortedSet<URI> remainingDomains = new TreeSet<URI>();

            for (final ServiceProvider remainingServiceProvider : serviceProviders.values())
            {
                remainingDomains.addAll(getServiceProviderDomains(remainingServiceProvider));
            }

            final SortedSet<URI> removedServiceProviderDomains = getServiceProviderDomains(deregisteredServiceProvider);

            removedServiceProviderDomains.removeAll(remainingDomains);
            serviceProviderCatalog.removeDomains(removedServiceProviderDomains);
            serviceProviderCatalog.removeServiceProvider(deregisteredServiceProvider);
        }
        else
        {
            throw new WebApplicationException(Status.NOT_FOUND);
        }
    }
}
 
开发者ID:EricssonResearch,项目名称:scott-eu,代码行数:29,代码来源:ServiceProviderCatalogSingleton.java

示例10: removeItem

import java.util.SortedSet; //导入方法依赖的package包/类
/**
    * Remove taskList item from HttpSession list and update page display. As authoring rule, all persist only happen
    * when user submit whole page. So this remove is just impact HttpSession values.
    *
    * @param mapping
    * @param form
    * @param request
    * @param response
    * @return
    */
   private ActionForward removeItem(ActionMapping mapping, ActionForm form, HttpServletRequest request,
    HttpServletResponse response) {

// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession().getAttribute(sessionMapID);

int itemIdx = NumberUtils.stringToInt(request.getParameter(TaskListConstants.PARAM_ITEM_INDEX), -1);
if (itemIdx != -1) {
    SortedSet<TaskListItem> taskListList = getTaskListItemList(sessionMap);
    List<TaskListItem> rList = new ArrayList<TaskListItem>(taskListList);
    TaskListItem item = rList.remove(itemIdx);
    taskListList.clear();
    taskListList.addAll(rList);
    // add to delList
    List delList = getDeletedTaskListItemList(sessionMap);
    delList.add(item);

    // delete tasklistitems that still may be contained in Conditions
    SortedSet<TaskListCondition> conditionList = getTaskListConditionList(sessionMap);
    for (TaskListCondition condition : conditionList) {
	Set<TaskListItem> itemList = condition.getTaskListItems();
	if (itemList.contains(item)) {
	    itemList.remove(item);
	}
    }

}

request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMapID);
return mapping.findForward(TaskListConstants.SUCCESS);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:AuthoringAction.java

示例11: complete

import java.util.SortedSet; //导入方法依赖的package包/类
@Override
public int complete(String buffer, int cursor, List<CharSequence> candidates) {
    // buffer could be null
    Preconditions.checkNotNull(candidates);
    SortedSet<String> strings = new TreeSet<>();

    TabCompleteEvent event = new TabCompleteEvent(buffer);
    EventExecutor.getInstance().execute(event);
    if(!event.isCancelled()) {
        List<String> l = event.getSuggestions();
        if(l != null) strings.addAll(l);
    }

    String currentBuffer = event.getCurrentBuffer();
    String add = event.getBeforeBuffer();

    if(currentBuffer == null) {
        for(String string : strings) {
            candidates.add(add + string);
        }
    }
    else {
        for(String match : strings.tailSet(currentBuffer)) {
            if(!match.startsWith(currentBuffer)) {
                break;
            }
            candidates.add(add + match);
        }
    }

    return candidates.isEmpty() ? -1 : 0;
}
 
开发者ID:Superioz,项目名称:MooProject,代码行数:33,代码来源:CandidateCompleter.java

示例12: sortedValues

import java.util.SortedSet; //导入方法依赖的package包/类
/**
 * Returns the list of values sorted in descending order by cardinality
 * @param h
 * @return
 */
public static <X> Collection<X> sortedValues(final Histogram<X> h) {
    SortedSet<X> sorted = new TreeSet<X>(new Comparator<X>() {
        public int compare(final X item0, final X item1) {
            final Long v0 = h.get(item0);
            final Long v1 = h.get(item1);
            if (v0.equals(v1))
                return (-1);
            return (v1.compareTo(v0));
          }
    });
    sorted.addAll(h.values());
    return (sorted);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:19,代码来源:HistogramUtil.java

示例13: testToFlexgrid50Plus1

import java.util.SortedSet; //导入方法依赖的package包/类
@Test
public void testToFlexgrid50Plus1() {
    OchSignal input = newDwdmSlot(CHL_50GHZ, 1);
    SortedSet<OchSignal> expected = newOchSignalTreeSet();
    // Note: 8 = 50Ghz / 6.25Ghz
    expected.addAll(ImmutableList.of(
                newFlexGridSlot(8 - 3), newFlexGridSlot(8 - 1),
                newFlexGridSlot(8 + 1), newFlexGridSlot(8 + 3)));

    SortedSet<OchSignal> flexGrid = OchSignal.toFlexGrid(input);

    assertEquals(expected, flexGrid);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:OchSignalTest.java

示例14: testToFlexgrid50minus1

import java.util.SortedSet; //导入方法依赖的package包/类
@Test
public void testToFlexgrid50minus1() {
    OchSignal input = newDwdmSlot(CHL_50GHZ, -1);
    SortedSet<OchSignal> expected = newOchSignalTreeSet();
    // Note: 8 = 50Ghz / 6.25Ghz
    expected.addAll(ImmutableList.of(
                newFlexGridSlot(-8 - 3), newFlexGridSlot(-8 - 1),
                newFlexGridSlot(-8 + 1), newFlexGridSlot(-8 + 3)));

    SortedSet<OchSignal> flexGrid = OchSignal.toFlexGrid(input);

    assertEquals(expected, flexGrid);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:OchSignalTest.java

示例15: getBackups

import java.util.SortedSet; //导入方法依赖的package包/类
public Collection getBackups() {
	Collection backups = selector.select(new SelectCondition(), null);
	SortedSet result = Collections.synchronizedSortedSet(new TreeSet(comp));
	result.addAll(backups);
	return result;
}
 
开发者ID:yswang0927,项目名称:ralasafe,代码行数:7,代码来源:BackupManagerImpl.java


注:本文中的java.util.SortedSet.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。