本文整理汇总了Java中java.util.LinkedList.size方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedList.size方法的具体用法?Java LinkedList.size怎么用?Java LinkedList.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.LinkedList
的用法示例。
在下文中一共展示了LinkedList.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceChildren
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public AbstractExpr replaceChildren(LinkedList<PatternExprUnitMap> listFromToMap, boolean bExpr2Pattern, LinkedList<AbstractExpr> listReplacedChildren) throws JFCALCExpErrException, JSmartMathErrException {
AEMulDivOpt aeReturn = new AEMulDivOpt();
aeReturn.copy(this);
for (int idx = 0; idx < aeReturn.mlistChildren.size(); idx ++) {
for (int idx1 = 0; idx1 < listFromToMap.size(); idx1 ++) {
if (bExpr2Pattern && aeReturn.mlistChildren.get(idx).isEqual(listFromToMap.get(idx1).maeExprUnit)) {
aeReturn.mlistChildren.set(idx, listFromToMap.get(idx1).maePatternUnit); // need to clone because will be many aeTo copies. To make it simple, not clone.
listReplacedChildren.add(aeReturn.mlistChildren.get(idx));
break;
} else if ((!bExpr2Pattern) && aeReturn.mlistChildren.get(idx).isEqual(listFromToMap.get(idx1).maePatternUnit)) {
aeReturn.mlistChildren.set(idx, listFromToMap.get(idx1).maeExprUnit); // need to clone because will be many aeTo copies. To make it simple, not clone.
listReplacedChildren.add(aeReturn.mlistChildren.get(idx));
break;
}
}
}
return aeReturn;
}
示例2: validate
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* Overall validation
* @param value Value to validate
* @throws OverallValidationException If validation fails
*/
protected void validate(PropertyBox value) throws OverallValidationException {
LinkedList<ValidationException> failures = new LinkedList<>();
for (Validator<PropertyBox> validator : getValidators()) {
try {
validator.validate(value);
} catch (ValidationException ve) {
failures.add(ve);
if (isStopOverallValidationAtFirstFailure()) {
break;
}
}
}
// collect validation exceptions, if any
if (!failures.isEmpty()) {
OverallValidationException validationException = (failures.size() == 1)
? new OverallValidationException(failures.getFirst().getMessage(),
failures.getFirst().getMessageCode(), failures.getFirst().getMessageArguments())
: new OverallValidationException(failures.toArray(new ValidationException[failures.size()]));
// notify validation status
notifyInvalidValidationStatus(validationException, getOverallValueComponent().orElse(null), null);
throw validationException;
}
// notify validation status
notifyValidValidationStatus(getOverallValueComponent().orElse(null), null);
}
示例3: getDayOfWeek
import java.util.LinkedList; //导入方法依赖的package包/类
public static DataClass getDayOfWeek(LinkedList<DataClass> listParams) throws JFCALCExpErrException {
if (listParams.size() != 1) {
throw new JFCALCExpErrException(ERRORTYPES.ERROR_INCORRECT_NUM_OF_PARAMETER);
}
DataClass datumTS = new DataClass();
datumTS.copyTypeValueDeep(listParams.removeLast());
datumTS.changeDataType(DATATYPES.DATUM_INTEGER);
long lTS = datumTS.getDataValue().longValue();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(lTS);
int nReturn = cal.get(Calendar.DAY_OF_WEEK);
int nDayOfWeek = 0;
switch (nReturn) {
case (Calendar.SUNDAY): {
nDayOfWeek = 0;
break;
} case (Calendar.MONDAY): {
nDayOfWeek = 1;
break;
} case (Calendar.TUESDAY): {
nDayOfWeek = 2;
break;
} case (Calendar.WEDNESDAY): {
nDayOfWeek = 3;
break;
} case (Calendar.THURSDAY): {
nDayOfWeek = 4;
break;
} case (Calendar.FRIDAY): {
nDayOfWeek = 5;
break;
} case (Calendar.SATURDAY): {
nDayOfWeek = 6;
break;
}
}
return new DataClass(DATATYPES.DATUM_INTEGER, new MFPNumeric(nDayOfWeek));
}
示例4: addRecentCache
import java.util.LinkedList; //导入方法依赖的package包/类
private static void addRecentCache(Context context, Author... authors) {
final LinkedList<Author> localCache = getRecentCache(context);
// 避免重复添加
for (Author author : authors) {
if (author == null
|| author.getId() <= 0
|| TextUtils.isEmpty(author.getName())
|| author.getId() == AccountHelper.getUserId())
continue;
if (checkInContacts(localCache, author)) {
// 移除后添加到头部
int index = indexOfContacts(localCache, author);
if (index >= 0) {
localCache.remove(index);
localCache.addFirst(author);
}
} else {
localCache.addFirst(author);
}
}
// 至多存储15条
while (localCache.size() > 10) {
localCache.removeLast();
}
CacheManager.saveToJson(context, RECENT_CACHE_FILE, localCache);
}
示例5: getChassisEthernetPortIndexs
import java.util.LinkedList; //导入方法依赖的package包/类
public int[] getChassisEthernetPortIndexs(ConsoleAccess telnet)
throws IOException, ConsoleException, AbortedException {
LinkedList<Integer> list = new LinkedList<Integer>();
for (Integer i : ethernetPorts) {
if ((new ShowEther(telnet, i).isPresence()) == 1) {
list.add(i);
}
}
int[] idx = new int[list.size()];
for (int i = 0; i < list.size(); i++) {
idx[i] = list.get(i).intValue();
}
return idx;
}
示例6: getDayOfYear
import java.util.LinkedList; //导入方法依赖的package包/类
public static DataClass getDayOfYear(LinkedList<DataClass> listParams) throws JFCALCExpErrException {
if (listParams.size() != 1) {
throw new JFCALCExpErrException(ERRORTYPES.ERROR_INCORRECT_NUM_OF_PARAMETER);
}
DataClass datumTS = new DataClass();
datumTS.copyTypeValueDeep(listParams.removeLast());
datumTS.changeDataType(DATATYPES.DATUM_INTEGER);
long lTS = datumTS.getDataValue().longValue();
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(lTS);
int nReturn = cal.get(Calendar.DAY_OF_YEAR);
return new DataClass(DATATYPES.DATUM_INTEGER, new MFPNumeric(nReturn));
}
示例7: filterusersByOffice
import java.util.LinkedList; //导入方法依赖的package包/类
private LinkedList<QUser> filterusersByOffice(LinkedList<QUser> AllUsers) {
LinkedList<QUser> Nusers = new LinkedList<QUser>();
if (isLogin()) {
Long userId = user.getUser().getId();
QUser quser = QUserList.getInstance().getById(userId);
for (int i = 0; i < AllUsers.size(); i++) {
if (AllUsers.get(i).getOffice().getId() == quser.getOffice().getId()) {
Nusers.add(AllUsers.get(i));
}
}
}
return Nusers;
}
示例8: copySetListOfChildren
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public AbstractExpr copySetListOfChildren(LinkedList<AbstractExpr> listChildren) throws JFCALCExpErrException, JSmartMathErrException {
if (listChildren == null || listChildren.size() != 1) {
throw new JSmartMathErrException(ERRORTYPES.ERROR_INVALID_ABSTRACTEXPR);
}
AEUnaryOpt aeReturn = new AEUnaryOpt();
aeReturn.copy(this);
aeReturn.maexprChild = listChildren.getFirst();
aeReturn.validateAbstractExpr();
return aeReturn;
}
示例9: removeCardsByIDs
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public void removeCardsByIDs(LinkedList<Integer> ids) {
for (int i = 0; i < cards.size(); i++) {
Card card = cards.get(i);
for(int j = 0; j < ids.size(); j++){
if(card.getID() == ids.get(j)){
cards.remove(i);
break;
}
}
}
}
示例10: findNode
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* Method used to find a node according to its Gorn address
*/
public void findNode(Node n, String address, List<Node> ln) {
TagNode nn = (TagNode) n;
if (nn.getAddress().equals(address)) {
ln.add(n);
} else {
if (n.getChildren() != null) {
LinkedList<Node> l = (LinkedList<Node>) n.getChildren();
for (int i = 0; i < l.size(); i++) {
findNode(l.get(i), address, ln);
}
}
}
}
示例11: processOptions
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
if (args.size() != 3) {
throw new IllegalArgumentException("Incorrect number of arguments.");
}
newName = args.removeLast();
oldName = args.removeLast();
}
示例12: populateInputPads
import java.util.LinkedList; //导入方法依赖的package包/类
public void populateInputPads(LinkedList<TableInputPad> listInputPads) {
// load all the input pads.
mlistInputPadViews.clear();
mlistInputPadViewsLand.clear();
for (int index = 0; index < listInputPads.size(); index ++) {
TableInputPad inputPad = listInputPads.get(index);
View vInputPad = populateInputPad(inputPad, index, false);
View vInputPadLand = populateInputPad(inputPad, index, true);
if (vInputPad != null && vInputPadLand != null) {
mlistInputPadViews.add(vInputPad);
mlistInputPadViewsLand.add(vInputPadLand);
}
}
}
示例13: dump_stack
import java.util.LinkedList; //导入方法依赖的package包/类
public static void dump_stack(LinkedList<TraverseStackNode> stack, String prefix) {
int size = stack.size();
System.out.println(prefix + "lasting traverse stack size (" + size + ")");
for (int i = 0; i < size; i++) {
System.out.println(prefix + "(" + (size - i - 1) + ") " + stack.get(i));
}
}
示例14: validateInputs
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* Validate all the {@link Input}s.
* @throws ValidationException If one or more input is not valid
*/
private void validateInputs() throws ValidationException {
LinkedList<ValidationException> failures = new LinkedList<>();
// get all property configurations
List<PropertyConfiguration<?>> configurations = propertySet.stream().map(p -> _propertyConfiguration(p))
.filter(cfg -> !cfg.isReadOnly() && !cfg.isHidden() && cfg.getInput().isPresent())
.collect(Collectors.toList());
if (configurations != null) {
if (isStopValidationAtFirstFailure()) {
// reset validation status
configurations.forEach(c -> resetValidationStatus(c.getInput().get(), c.getProperty()));
}
for (PropertyConfiguration<?> configuration : configurations) {
try {
validateProperty(configuration);
} catch (ValidationException e) {
failures.add(e);
if (isStopValidationAtFirstFailure()) {
// break if stop validation at first failure
break;
}
}
}
}
// collect validation exceptions, if any
if (!failures.isEmpty()) {
if (failures.size() == 1) {
throw failures.getFirst();
} else {
throw new ValidationException(failures.toArray(new ValidationException[0]));
}
}
}
示例15: createPath
import java.util.LinkedList; //导入方法依赖的package包/类
/** Find a path (by name) from one node to the root or a parent.
* @param node the node to start in
* @param parent parent node to stop in (can be <code>null</code> for the root)
* @return list of child names--i.e. a path from the parent to the child node
* @exception IllegalArgumentException if <code>node</code>'s getName()
* method returns <code>null</code>
*/
public static String[] createPath(Node node, Node parent) {
LinkedList<String> ar = new LinkedList<String>();
while ((node != null) && (node != parent)) {
if (node.getName() == null) {
boolean isFilter = false;
if (node instanceof FilterNode) {
isFilter = true;
}
throw new IllegalArgumentException(
"Node:" + node.getClass() // NOI18N
+"[" + node.getDisplayName() + "]" // NOI18N
+(isFilter ? (" of original:" + ((FilterNode) node).getOriginal().getClass()) : "") // NOI18N
+" gets null name!"
); // NOI18N
}
ar.addFirst(node.getName());
node = node.getParentNode();
}
String[] res = new String[ar.size()];
ar.toArray(res);
return res;
}