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


Java LinkedHashSet.size方法代码示例

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


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

示例1: queueRefreshAndSubmit

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private void queueRefreshAndSubmit(LinkedHashSet<String> tenantIds)
{
    if((tenantIds == null) || (tenantIds.size() == 0))
    {
        return;
    }
    refreshLock.writeLock().lock();
    try
    {
        for (String tenantId : tenantIds)
        {
            if (logger.isDebugEnabled())
            {
                logger.debug("Async cache adding refresh to queue for tenant " + tenantId + " on " + this);
            }
            refreshQueue.add(new Refresh(tenantId));
        }
    }
    finally
    {
        refreshLock.writeLock().unlock();
    }
    submit();
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:25,代码来源:AbstractAsynchronouslyRefreshedCache.java

示例2: toMap

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Get back a Map of String*String from its String representation.
 * Unescape backslashed separator characters.
 * @param string String to convert to a Map
 * @return a Map
 * @see #toString(java.util.Map)
 */
public static Map<String, String> toMap(String string) {
  Map<String, String> map = new HashMap<String, String>();
  if (string == null
   || string.length() < 3) {
    return map;
  }
  Set<String> firstList = toSet(string, ", ");
  for (String element : firstList) {
    LinkedHashSet<String> secondList = toSet("[" + element + "]", "=");
    if (secondList.size() == 2) {
      Iterator<String> iterator = secondList.iterator();
      map.put(iterator.next(), iterator.next());
    } else {
      Err.prln("Ignoring element: [" + element + "]");
      Err.prln("Expecting: [key=value]");
    }
  }
  return map;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:27,代码来源:Strings.java

示例3: getEntityIdsMapping

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * @deprecated use {@link #readEntityIdsMapping(JavaRDD)} instead, to get the entity mappings used in blocking
 * Maps an entity url to its entity id, that is also used by blocking.
 * @param rawTriples
 * @param SEPARATOR
 * @return a map from an entity url to its entity id, that is also used by blocking.
 */
public static Object2IntOpenHashMap<String> getEntityIdsMapping(JavaRDD<String> rawTriples, String SEPARATOR) {        
    LinkedHashSet<String> subjectsSet =                  
        new LinkedHashSet<>(rawTriples
        .map(line -> line.split(SEPARATOR)[0])
        .collect()                
        ); //convert list to set (to remove duplicates)
    
    Object2IntOpenHashMap<String> result = new Object2IntOpenHashMap<>(subjectsSet.size());
    result.defaultReturnValue(-1);
    int index = 0;
    for (String subject : subjectsSet) {
        result.put(subject, index++);
    }
    return result;
}
 
开发者ID:vefthym,项目名称:MinoanER,代码行数:23,代码来源:Utils.java

示例4: maybeGetLowerBound

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private static PsiType maybeGetLowerBound( PsiWildcardType type, TypeVarToTypeMap actualParamByVarName, boolean bKeepTypeVars, LinkedHashSet<PsiType> recursiveTypes )
{
  PsiType lower = type.getSuperBound();
  if( lower != PsiType.NULL && recursiveTypes.size() > 0 )
  {
    // This is a "super" (contravariant) wildcard

    LinkedList<PsiType> list = new LinkedList<>( recursiveTypes );
    PsiType enclType = list.getLast();
    if( isParameterizedType( enclType ) )
    {
      PsiType genType = getActualType( ((PsiClassType)enclType).rawType(), actualParamByVarName, bKeepTypeVars, recursiveTypes );
      if( LambdaUtil.isFunctionalType( genType ) )
      {
        // For functional interfaces we keep the lower bound as an upper bound so that blocks maintain contravariance wrt the single method's parameters
        return lower;
      }
    }
  }
  return null;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:22,代码来源:TypeUtil.java

示例5: truncate

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Truncates the given list to a list containing the first MAX_NUMBER_ENTRIES entries of that list.
 * <p>
 * Does not modify the original list.
 *
 * @param fileList the original list
 * @return the truncated list
 */
@SuppressWarnings("PMD.LooseCoupling") // LinkedHashSet must be used because its contents must be ordered
private static LinkedHashSet<File> truncate(final LinkedHashSet<File> fileList) {
    final LinkedHashSet<File> truncatedSet = new LinkedHashSet<>();
    final Iterator<File> fileIterator = fileList.iterator();

    while (fileIterator.hasNext() && truncatedSet.size() < MAX_NUMBER_ENTRIES) {
        truncatedSet.add(fileIterator.next());
    }
    return truncatedSet;
}
 
开发者ID:ProgrammingLife2017,项目名称:hygene,代码行数:19,代码来源:RecentFiles.java

示例6: buildSeeds

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private HashSet<Sequence> buildSeeds(LinkedHashSet<Item> frequentItems) {
	HashSet<Sequence> seeds = new HashSet<>(frequentItems.size());
	for (Item item : frequentItems) {
		Transaction transaction = new Transaction(Double.NaN);
		transaction.add(item);
		Sequence sequence = new Sequence();
		sequence.add(transaction);
		seeds.add(sequence);
	}
	return seeds;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:12,代码来源:GSPOperator.java

示例7: getIPs

import java.util.LinkedHashSet; //导入方法依赖的package包/类
/**
 * Returns all the IPs associated with the provided interface, if any, in
 * textual form.
 * 
 * @param strInterface
 *            The name of the network interface or sub-interface to query
 *            (eg eth0 or eth0:0) or the string "default"
 * @param returnSubinterfaces
 *            Whether to return IPs associated with subinterfaces of
 *            the given interface
 * @return A string vector of all the IPs associated with the provided
 *         interface. The local host IP is returned if the interface
 *         name "default" is specified or there is an I/O error looking
 *         for the given interface.
 * @throws UnknownHostException
 *             If the given interface is invalid
 * 
 */
public static String[] getIPs(String strInterface,
    boolean returnSubinterfaces) throws UnknownHostException {
  if ("default".equals(strInterface)) {
    return new String[] { cachedHostAddress };
  }
  NetworkInterface netIf;
  try {
    netIf = NetworkInterface.getByName(strInterface);
    if (netIf == null) {
      netIf = getSubinterface(strInterface);
    }
  } catch (SocketException e) {
    LOG.warn("I/O error finding interface " + strInterface +
        ": " + e.getMessage());
    return new String[] { cachedHostAddress };
  }
  if (netIf == null) {
    throw new UnknownHostException("No such interface " + strInterface);
  }

  // NB: Using a LinkedHashSet to preserve the order for callers
  // that depend on a particular element being 1st in the array.
  // For example, getDefaultIP always returns the first element.
  LinkedHashSet<InetAddress> allAddrs = new LinkedHashSet<InetAddress>();
  allAddrs.addAll(Collections.list(netIf.getInetAddresses()));
  if (!returnSubinterfaces) {
    allAddrs.removeAll(getSubinterfaceInetAddrs(netIf));
  }

  String ips[] = new String[allAddrs.size()];
  int i = 0;
  for (InetAddress addr : allAddrs) {
    ips[i++] = addr.getHostAddress();
  }
  return ips;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:55,代码来源:DNS.java

示例8: toReversePrimitiveArray

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private String[] toReversePrimitiveArray(@NonNull LinkedHashSet<String> emojiSet) {
  String[] emojis = new String[emojiSet.size()];
  int i = emojiSet.size() - 1;
  for (String emoji : emojiSet) {
    emojis[i--] = emoji;
  }
  return emojis;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:9,代码来源:RecentEmojiPageModel.java

示例9: toReversePrimitiveArray

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private String[] toReversePrimitiveArray(LinkedHashSet<String> emojiSet) {
	String[] emojis = new String[emojiSet.size()];
	int i = emojiSet.size() - 1;
	for (String emoji : emojiSet) {
		emojis[i--] = emoji;
	}
	return emojis;
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:9,代码来源:RecentEmojiPageModel.java

示例10: createCookbookSearchPath

import java.util.LinkedHashSet; //导入方法依赖的package包/类
protected LinkedHashSet<String> createCookbookSearchPath(String cookbookRelativePath,
    Map<String, Map<String, CmsCISimple>> cloudServices,
    String cloudName) {
  String cookbookDir = config.getCircuitDir();
  if (!cookbookRelativePath.equals("")) {
    cookbookDir = config.getCircuitDir().replace("packer",
        cookbookRelativePath);
  }

  cookbookDir += "/components/cookbooks";
  String sharedDir = config.getCircuitDir().replace("packer", "shared/cookbooks");

  LinkedHashSet<String> cookbookPaths = new LinkedHashSet<>();
  if (cloudServices != null) {
    for (String serviceName : cloudServices.keySet()) { // for each service
      CmsCISimple serviceCi = cloudServices.get(serviceName).get(cloudName);
      if (serviceCi != null) {
        String serviceClassName = serviceCi.getCiClassName();
        String serviceCookbookCircuit = getCookbookPath(serviceClassName);
        if (!serviceCookbookCircuit.equals(cookbookRelativePath)) {
          cookbookPaths.add(config.getCircuitDir().replace("packer", serviceCookbookCircuit)
              + "/components/cookbooks");
        }
      }
    }
  }
  if (cookbookPaths.size() > 0) {
    //Remove the current component's circuit from the cookbook_path so that we can add it after other circuits
    //This is to make sure the current component's circuit is higher priority in search path
    cookbookPaths.remove(cookbookDir);
  }
  cookbookPaths.add(cookbookDir);
  cookbookPaths.add(sharedDir);
  return cookbookPaths;
}
 
开发者ID:oneops,项目名称:oneops,代码行数:36,代码来源:AbstractOrderExecutor.java

示例11: applyTomorrow

import java.util.LinkedHashSet; //导入方法依赖的package包/类
private void applyTomorrow(View view) {
    TimelessDate tomorrow = new TimelessDate();
    DateUtilities.Backport.AddDays(tomorrow, 1);
    LinkedHashSet<BackportAppointment> tomorrowAppointments = DateUtilities.Backport.GetAppointmentsOfDayAsSet(tomorrow,
            TimetableManager.getInstance().getGlobalsAsSet());
    TextView beginView = view.findViewById(R.id.beginTime);
    TextView tomorrowSummaryView = view.findViewById(R.id.tomorrowSummary);
    if (tomorrowAppointments.size() > 0) {
        final SharedPreferences sharedPref = getActivity().getSharedPreferences(
                getString(R.string.preference_file_key), Context.MODE_PRIVATE);

        GregorianCalendar startDate = ((BackportAppointment) tomorrowAppointments.toArray()[0]).getStartDate();
        int shiftInMillis = ((60 * sharedPref.getInt("alarmFirstShiftHour", 0))
                + sharedPref.getInt("alarmFirstShiftMinute", 0)) * 60 * 1000;

        String alarm;

        if (sharedPref.getBoolean("alarmOnFirstEvent", false)) {
            alarm = shiftInMillis > 0 ? DateUtilities.GERMAN_STD_STIMEFORMAT.format(startDate.getTimeInMillis() - shiftInMillis) : "Immediately";
        } else {
            alarm = "None";
        }

        beginView.setText(String.format("Alarm: %s\nBegin: %s", alarm, DateUtilities.GERMAN_STD_STIMEFORMAT.format(startDate.getTime())));
        StringBuilder sb = new StringBuilder();
        for (BackportAppointment a : tomorrowAppointments)
            sb.append(a.getTitle()).append(",\n");
        // Delete last comma
        sb.deleteCharAt(sb.length() - 2);
        tomorrowSummaryView.setText(sb.toString());
    } else {
        beginView.setText("No appointments");
        tomorrowSummaryView.setText("");
    }
}
 
开发者ID:dhbw-timetable,项目名称:dhbw-timetable-android,代码行数:36,代码来源:TodayFragment.java


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