當前位置: 首頁>>代碼示例>>Java>>正文


Java List.size方法代碼示例

本文整理匯總了Java中java.util.List.size方法的典型用法代碼示例。如果您正苦於以下問題:Java List.size方法的具體用法?Java List.size怎麽用?Java List.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.List的用法示例。


在下文中一共展示了List.size方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: exportExcel

import java.util.List; //導入方法依賴的package包/類
/**
 * 導出
 * @param modelName 模型名稱
 * @param excelType excel格式
 * @param response
 * @return
 * @throws IOException
 */
@RequestMapping(value = { "/excel/{modelName}","/excel/{modelName}/{excelType}" }, method = RequestMethod.GET)
public void exportExcel(@PathVariable String modelName,@PathVariable(required = false) String excelType, HttpServletResponse response) throws IOException {
    //默認導出xls格式excel
    if(excelType==null||"".equals(excelType)){
        excelType="XLS";
    }
    List<SysExportModel> models = modelService.queryExportModelByCondition(modelName);
    // 模型不存在 直接結束
    if (models == null || models.size() == 0) {
        return;
    }
    // 獲取導出數據
    SysExportModel model = models.get(0);
    List<List<Object>> exportData = commonService.getAllData(model.getModelName(), model.getEnames(), null);
    List<String> exportHeaderNames = new ArrayList<String>();
    String[] headerNames = model.getCnames().split(",");
    for (String headerName : headerNames) {
        exportHeaderNames.add(headerName);
    }

    response.reset();
    // 文件下載
    response.setContentType("application/vnd.ms-excel");
    String filename = "報表"+modelName+"("+ new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())+ ")";

    filename = new String(filename.getBytes("gbk"), "iso-8859-1");
    response.setHeader("Content-disposition", "attachment;filename="+ filename + "."+excelType.toLowerCase());
    response.setBufferSize(1024);

    //獲取excel表單
    ExcelGenerater excelGenerater=new ExcelGenerater();
    ExcelGeneraterBean excelGeneraterBean = excelGenerater.create(modelName, exportHeaderNames, exportData);
    Workbook workbook = excelGeneraterBean.getWorkbook();
    //寫入數據 到流
    workbook.write(response.getOutputStream());
    workbook.close();
}
 
開發者ID:babymm,項目名稱:mumu,代碼行數:46,代碼來源:ExportController.java

示例2: findFirstLambda

import java.util.List; //導入方法依賴的package包/類
/**
 * Returns list of consecutive resources in given set of lambdas.
 *
 * @param lambdas list of lambdas
 * @param count number of consecutive lambdas to return
 * @return list of consecutive lambdas
 */
private List<OchSignal> findFirstLambda(Set<OchSignal> lambdas, int count) {
    // Sort available lambdas
    List<OchSignal> lambdaList = new ArrayList<>(lambdas);
    lambdaList.sort(new DefaultOchSignalComparator());

    // Look ahead by count and ensure spacing multiplier is as expected (i.e., no gaps)
    for (int i = 0; i < lambdaList.size() - count; i++) {
        if (lambdaList.get(i).spacingMultiplier() + 2 * count ==
                lambdaList.get(i + count).spacingMultiplier()) {
            return lambdaList.subList(i, i + count);
        }
    }

    return Collections.emptyList();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:23,代碼來源:OpticalConnectivityIntentCompiler.java

示例3: setBannerImageList

import java.util.List; //導入方法依賴的package包/類
/**
 * Sets the picture list
 *
 * @param imagesUrl picture list
 */
public void setBannerImageList(List<?> imagesUrl) {
    if (imagesUrl == null || imagesUrl.size() <= 0) {
        return;
    }
    count = imagesUrl.size();
    initImages();
    for (int i = 0; i <= count + 1; i++) {
        ImageView iv = new ImageView(context);
        iv.setScaleType(ImageView.ScaleType.FIT_XY);
        Object url;
        if (i == 0) {
            url = imagesUrl.get(count - 1);
        } else if (i == count + 1) {
            url = imagesUrl.get(0);
        } else {
            url = imagesUrl.get(i - 1);
        }
        imageViews.add(iv);
        if (defaultImage != -1)
            Glide.with(context).load(url).centerCrop().crossFade().into(iv);
        else
            Glide.with(context).load(url).centerCrop().crossFade().placeholder(defaultImage).into(iv);

    }
    setData();
}
 
開發者ID:shenhuanet,項目名稱:AndroidOpen,代碼行數:32,代碼來源:BannerView.java

示例4: isAccessibilityNodeEnable

import java.util.List; //導入方法依賴的package包/類
public static boolean isAccessibilityNodeEnable(AccessibilityNodeInfo info, String[] texts) {
    if (texts != null) {
        for (String textItem : texts) {
            List<AccessibilityNodeInfo> nodes = info.findAccessibilityNodeInfosByText(textItem);
            if (nodes != null && !nodes.isEmpty()) {
                AccessibilityNodeInfo node;
                for (int i = 0; i < nodes.size(); i++) {
                    node = nodes.get(i);
                    BaseAccessibility.logPrint("find text=" + textItem + "  enable=" + node.isEnabled());
                    CharSequence text = node.getText();
                    if (TextUtils.equals(text, textItem) && node.isEnabled()) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
 
開發者ID:miLLlulei,項目名稱:Accessibility,代碼行數:20,代碼來源:BaseAccessibility.java

示例5: decode

import java.util.List; //導入方法依賴的package包/類
/**
 *
 * @param ABFSetCodes
 * @return
 */
public static List<String> decode(List<String> ABFSetCodes)   {

    List<String> abfStrings = new ArrayList<>();

    for (int i = 0; i < ABFSetCodes.size(); i++) {
        if(ABFSetCodes.get(i) == null ) continue;
        BitSet bs = convert(Long.parseLong(ABFSetCodes.get(i)));
        for (int j = 0; j < bs.length(); j++) {
            if (bs.get(j)==true) {
                abfStrings.add(ABFMAPPER.inverse().get(j + (64 * i) + ""));
            }
        }
    }
    return abfStrings;
}
 
開發者ID:tmobile,項目名稱:keybiner,代碼行數:21,代碼來源:Permission64.java

示例6: deleteKeys

import java.util.List; //導入方法依賴的package包/類
private void deleteKeys(Iterable<Key> keys) {
	Datastore datastore = this.datastoreOptions.getService();

	List<Key> buffer = new ArrayList<>(BUFFER_SIZE);
	for (Key key : keys) {
		buffer.add(key);

		if (buffer.size() >= BUFFER_SIZE) {
			datastore.delete(buffer.toArray(new Key[buffer.size()]));
			buffer.clear();
		}
	}
	if (buffer.size() > 0) {
		datastore.delete(buffer.toArray(new Key[buffer.size()]));
	}
}
 
開發者ID:tkob,項目名稱:spring-data-gclouddatastore,代碼行數:17,代碼來源:SimpleGcloudDatastoreRepository.java

示例7: dumpLayers

import java.util.List; //導入方法依賴的package包/類
private static void dumpLayers(StringBuilder sb, String prefix, List<? extends HighlightsLayer> layers) {
    sb.append(prefix).append(" layers:\n"); //NOI18N
    int digitCount = ArrayUtilities.digitCount(layers.size());
    for (int i = 0; i < layers.size(); i++) {
        HighlightsLayer layer = layers.get(i);
        HighlightsLayerAccessor layerAccessor = 
            HighlightingSpiPackageAccessor.get().getHighlightsLayerAccessor(layer);

        sb.append("  ");
        ArrayUtilities.appendBracketedIndex(sb, i, digitCount);
        sb.append(layerAccessor.getLayerTypeId());
        sb.append('['); //NOI18N
        sb.append(layerAccessor.getZOrder().toString()); //NOI18N
        sb.append(layerAccessor.isFixedSize() ? ",Fixed" : ",NonFixed");
        sb.append(']'); //NOI18N
        sb.append('@'); //NOI18N
        sb.append(Integer.toHexString(System.identityHashCode(layer)));
        sb.append("\n"); //NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:HighlightingManager.java

示例8: valideerAantalZoekResultaten

import java.util.List; //導入方法依賴的package包/類
@Override
protected void valideerAantalZoekResultaten(final List<Persoonslijst> persoonslijsten, final Autorisatiebundel autorisatiebundel,
                                            final ZoekPersoonGeneriekVerzoek.ZoekBereikParameters zoekBereikParameters) throws StapMeldingException {
    if (persoonslijsten.size() > 1) {
        throw new StapMeldingException(Regel.R2289);
    }
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:8,代碼來源:PersoonsvraagOphalenPersoonServiceImpl.java

示例9: setTitles

import java.util.List; //導入方法依賴的package包/類
public void setTitles(List<? extends Object> values) {
    if (mSectionizer == null) {
        throw new NullPointerException("請在設置調用setTitles()之前調用setSectionizer()方法!");
    }

    if (values == null || values.size() == 0) {
        mTitles.clear();
        notifyDataSetChanged();
        return;
    }

    List<Title> titles = convertToTitleList(values);
    Title[] titleArray = new Title[titles.size()];
    Title[] newTitles = titles.toArray(titleArray);

    mTitles.clear();

    Arrays.sort(newTitles, new Comparator<Title>() {
        @Override
        public int compare(Title o1, Title o2) {
            return (o1.firstPosition == o2.firstPosition ? 0 : (o1.firstPosition < o2.firstPosition ? -1 : 1));
        }
    });

    int offset = 0;
    for (Title title : newTitles) {
        title.titlePosition = title.firstPosition + offset;
        mTitles.append(title.titlePosition, title);
        ++offset;
    }

    notifyDataSetChanged();
}
 
開發者ID:yedashen,項目名稱:UltimateRecyclerView,代碼行數:34,代碼來源:TitleAdapter.java

示例10: main

import java.util.List; //導入方法依賴的package包/類
public static void main(String[] args) {
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
    int total = 0;
    List<String> list = new ArrayList<>();
    try {
        total = Integer.parseInt(bufferedReader.readLine());
        for (int i = 0; i < total; i++) {
            list.add(bufferedReader.readLine());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    HashMap<Character, Integer> map = new HashMap<>();
    for (int i = 0; i < list.size(); i++) {
        String temp = list.get(i);
        for (int j = 0; j < temp.length(); j++) {
            if (map.containsKey(temp.charAt(j))) {
                map.put(temp.charAt(j), map.get(temp.charAt(j)) + 1);
            } else {
                map.put(temp.charAt(j), 1);
            }
        }
        for (int j = 0; j < temp.length(); j++) {
            if (map.get(temp.charAt(j)) == 1) {
                System.out.println(temp.charAt(j));
                break;
            }
        }
    }
}
 
開發者ID:leon66666,項目名稱:JavaCommon,代碼行數:31,代碼來源:FindFirstOnceOccurCharactar.java

示例11: handleRow

import java.util.List; //導入方法依賴的package包/類
private List<Pair<String, String>> handleRow(List<Element> row) {
    List<Pair<String, String>> ret = Lists.newArrayList();

    for (int i = 0; i < row.size(); i++) {
        ret.add(Pair.of(keys.get(i), valueResolver.resolveValue(row.get(i))));
    }

    return ret;
}
 
開發者ID:virjar,項目名稱:vscrawler,代碼行數:10,代碼來源:TableEvaluator.java

示例12: computeExistPageFunctionCells

import java.util.List; //導入方法依賴的package包/類
public static void computeExistPageFunctionCells(Report report) {
	Context context=report.getContext();
	List<Cell> existPageFunctionCells=context.getExistPageFunctionCells();
	for(Cell cell:existPageFunctionCells){
		List<BindData> dataList=context.buildCellData(cell);
		if(dataList==null || dataList.size()==0){
			continue;
		}
		BindData bindData=dataList.get(0);
		cell.setData(bindData.getValue());
		cell.setBindData(bindData.getDataList());
		cell.doFormat();
		cell.doDataWrapCompute(context);
	}
}
 
開發者ID:youseries,項目名稱:ureport,代碼行數:16,代碼來源:PagingBuilder.java

示例13: readNewEvents

import java.util.List; //導入方法依賴的package包/類
private static List<EventLog.Event> readNewEvents(final CondomCore.CondomEvent type) throws IOException {
	final List<EventLog.Event> events = new ArrayList<>();
	EventLog.readEvents(new int[] { EVENT_TAG_MARK, "Condom".hashCode() + type.ordinal() }, events);
	if (events.isEmpty()) return Collections.emptyList();
	for (int i = events.size() - 1; i >= 0; i --) {
		final EventLog.Event event = events.get(i);
		if (event.getTag() == EVENT_TAG_MARK) {
			EventLog.writeEvent(EVENT_TAG_MARK);
			return events.subList(i + 1, events.size());
		}
	}
	EventLog.writeEvent(EVENT_TAG_MARK);
	return events;
}
 
開發者ID:Trumeet,項目名稱:MiPushFramework,代碼行數:15,代碼來源:CondomMiscTest.java

示例14: getByMessageId

import java.util.List; //導入方法依賴的package包/類
@Override
   public MessageSeq getByMessageId(Long messageId) {
List list = doFind(SQL_QUERY_GET_SEQ_BY_MESSAGE, messageId);
if (list != null) {
    if (list.size() > 1) {
	log.warn("Looking up message seq by message id=" + messageId + ". More than one message seq found!"
		+ list.toString());
    }
    return (MessageSeq) list.get(0);
} else {
    return null;
}
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:MessageSeqDao.java

示例15: getExportHistoryFile

import java.util.List; //導入方法依賴的package包/類
@Test
public void getExportHistoryFile() {
	
	AdminService adminService = new AdminService();
	List<ExportLabel> exportHistoryLabels = adminService.getExportHistoryFile(7);
	for (int i = 0; i < exportHistoryLabels.size() ; i++) {
		System.out.println(exportHistoryLabels.get(i).getImg_id());
	} 
}
 
開發者ID:codekongs,項目名稱:ImageClassify,代碼行數:10,代碼來源:AdminTest.java


注:本文中的java.util.List.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。