Tag: find

Java | 如何使用API​​在Google电子表格范围内查找值(行号和列号)?

我正在使用Java API(V4)从谷歌工作表中读取和编辑数据。 到目前为止,我能够根据行号和列号(索引)读取和编辑数据。 我想要做的是按照其特定值本地化数据(我想使用其值获取特定单元格的行和列号)。 到目前为止,这是我用来编辑数据的工作代码的一部分: // Copy the format from A1:C1 and paste it into A2:C5, so the data in // each column has the same background. requests.add(new Request() .setCopyPaste(new CopyPasteRequest() .setSource(new GridRange() .setSheetId(0) .setStartRowIndex(0) .setEndRowIndex(1) .setStartColumnIndex(0) .setEndColumnIndex(3)) .setDestination(new GridRange() .setSheetId(0) .setStartRowIndex(1) .setEndRowIndex(6) .setStartColumnIndex(0) .setEndColumnIndex(3)) .setPasteType(“PASTE_FORMAT”))); BatchUpdateSpreadsheetRequest batchUpdateRequest = new BatchUpdateSpreadsheetRequest() .setRequests(requests); 谁能帮帮我吗? 先感谢您。

获取arraylist中项目的索引;

我有一个名为AuctionItem的类。 AuctionItem类有一个名为getName()的方法,它返回一个String 。 如果我有一个AuctionItem类型的ArrayList ,那么返回ArrayList中具有特定名称的项的索引的最佳方法是什么? 我知道有一个.indexOf()函数。 该函数的参数是一个对象。 要查找具有名称的项,我应该只使用for循环,当找到该项时,返回ArrayList的元素位置? 有没有更好的办法?

如何查找符合多个条件的文档

我正在尝试使用操作数AND’d一起查询集合。 我有shell版本工作: db.widgets.find({color: ‘black, shape: ’round’, weight: 100}) 我无法找到Java等价物(使用本机驱动程序 )。 我尝试了各种各样的东西,但这是我最近的尝试: // Find all black, round widgets with weight 100 List criteria = new ArrayList(); criteria.add(new BasicDBObject(“color”, “black”)); criteria.add(new BasicDBObject(“shape”, “round”)); criteria.add(new BasicDBObject(“weight”, 100)); DBCursor cur = widgets.find(new BasicDBObject(“$and”, criteria)); // Get all matching widgets and put them into a list List widgetList = new […]