本文整理汇总了Java中com.gs.collections.impl.set.mutable.primitive.IntHashSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntHashSet.add方法的具体用法?Java IntHashSet.add怎么用?Java IntHashSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.gs.collections.impl.set.mutable.primitive.IntHashSet
的用法示例。
在下文中一共展示了IntHashSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCursorWithLargeInClauseAndEmptyTable
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testCursorWithLargeInClauseAndEmptyTable() throws Exception
{
IntHashSet set = new IntHashSet();
for (int i = 0; i < 1000000; i++)
{
set.add(i);
}
OrderFinder.findMany(OrderFinder.all()).deleteAll();
OrderFinder.findMany(OrderFinder.orderId().in(set)).forEachWithCursor(new DoWhileProcedure()
{
public boolean execute(Object o)
{
fail();
return true;
}
});
}
示例2: testBulkRefresh
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testBulkRefresh()
{
int startOrderId = 5000;
int countToInsert = 10;
IntHashSet orderIdSet = new IntHashSet();
OrderList list = new OrderList();
for(int i=0;i<countToInsert;i++)
{
Order order = new Order();
order.setOrderId(i+startOrderId);
order.setDescription("order number "+i);
order.setUserId(i+7000);
order.setOrderDate(new Timestamp(System.currentTimeMillis()));
list.add(order);
orderIdSet.add(i+startOrderId);
}
list.insertAll();
MithraTransaction tx = MithraManagerProvider.getMithraManager().startOrContinueTransaction();
int count = this.getRetrievalCount();
OrderList list2 = new OrderList(OrderFinder.orderId().in(orderIdSet));
list2.forceResolve();
assertTrue(list2.getOrderAt(1).zIsParticipatingInTransaction(tx));
tx.commit();
assertEquals(count + 1, this.getRetrievalCount() );
}
示例3: runListQueryAcrossTwoSources
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
private void runListQueryAcrossTwoSources()
{
IntHashSet intHashSet = new IntHashSet();
for (int i=1;i>-1007;i--)
{
intHashSet.add(i);
}
Operation op = AccountTransactionFinder.transactionId().notIn(intHashSet).and(AccountTransactionFinder.deskId().in(UnifiedSet.newSetWith("A", "B")));
AccountTransactionList list = new AccountTransactionList(op);
// Assert not only that the SQL execution does not fail but also that the in-clause is resolved correctly (upon retry) to retrieve the correct results
assertEquals(4, list.size());
Collection<String> tranIds = Iterate.collect(list, new Function<AccountTransaction, String>()
{
@Override
public String valueOf(AccountTransaction tran)
{
return tran.getDeskId() + ":" + tran.getTransactionId();
}
});
assertEquals(4, tranIds.size());
assertTrue(tranIds.contains("A:100"));
assertTrue(tranIds.contains("A:1000"));
assertTrue(tranIds.contains("B:10000"));
assertTrue(tranIds.contains("B:100000"));
}
示例4: testAggregateListWithLargeIn
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testAggregateListWithLargeIn()
{
IntHashSet set = new IntHashSet();
for(int i=0;i<2000;i++)
{
set.add(i);
}
AggregateList list = new AggregateList(SalesLineItemFinder.itemId().in(set));
list.addGroupBy("manufacturer", SalesLineItemFinder.manufacturerId());
list.addAggregateAttribute("quantity", SalesLineItemFinder.quantity().sum());
assertEquals(2, list.size());
// AggregateData data = list.get(0);
// assertEquals(2, data.getAttributeAsInt("div"));
// boolean haveOne = data.getAttributeAsInt("manufacturer") == 1;
// boolean haveTwo = data.getAttributeAsInt("manufacturer") == 2;
//
// data = list.get(1);
// assertEquals(2, data.getAttributeAsInt("div"));
// haveOne = haveOne || data.getAttributeAsInt("manufacturer") == 1;
// haveTwo = haveTwo || data.getAttributeAsInt("manufacturer") == 2;
//
// assertTrue(haveOne);
// assertTrue(haveTwo);
}
示例5: testLargeInClause
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testLargeInClause()
{
int initialId = 10000;
int setSize = 5200;
AllTypesList allTypesList = this.createNewAllTypesList(initialId, setSize);
allTypesList.insertAll();
IntHashSet idSet = new IntHashSet(setSize);
for(int i = 0; i < setSize; i++)
{
idSet.add(initialId+i);
}
AllTypesFinder.clearQueryCache();
Operation op = AllTypesFinder.id().in(idSet);
String sql = "select * from " + getSchemaName() + ".ALL_TYPES where ID >= "+initialId;
validateMithraResult(op, sql);
}
示例6: testLargeInClauseInParallel
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testLargeInClauseInParallel()
{
int initialId = 10000;
int setSize = 5200;
AllTypesList allTypesList = this.createNewAllTypesList(initialId, setSize);
allTypesList.insertAll();
IntHashSet idSet = new IntHashSet(setSize);
for (int i = 0; i < setSize; i++)
{
idSet.add(initialId + i);
}
AllTypesFinder.clearQueryCache();
final Operation op = AllTypesFinder.id().in(idSet);
final String sql = "select " + getAllTypesColumns() + " from mithra.ALL_TYPES where ID >= " + initialId;
AllTypesList list = new AllTypesList(op);
list.setNumberOfParallelThreads(5);
validateMithraResult(list, sql, 1);
}
示例7: testDeleteAllInBatchesWithIn
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testDeleteAllInBatchesWithIn()
{
OrderList list = createOrderList(5000, 1000);
list.bulkInsertAll();
IntHashSet ids = new IntHashSet(5000);
for (int i = 1000; i < (6000); i++)
{
ids.add(i);
}
OrderList firstList = new OrderList(OrderFinder.orderId().in(ids));
firstList.deleteAllInBatches(500);
validateMithraResult(OrderFinder.userId().eq(999), "SELECT * FROM ORDERS WHERE USER_ID = 999", 0);
}
示例8: testLargeInClause
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testLargeInClause()
{
int initialId = 10000;
int setSize = 5200;
AllTypesList allTypesList = this.createNewAllTypesList(initialId, setSize);
allTypesList.insertAll();
IntHashSet idSet = new IntHashSet(setSize);
for (int i = 0; i < setSize; i++)
{
idSet.add(initialId + i);
}
AllTypesFinder.clearQueryCache();
Operation op = AllTypesFinder.id().in(idSet);
String sql = "select " + getAllTypesColumns() + " from public.ALL_TYPES where ID >= " + initialId;
validateMithraResult(op, sql);
}
示例9: testTwoLargeInClauseWithCursor
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testTwoLargeInClauseWithCursor()
{
int initialId = 10000;
int setSize = 8000;
AllTypesList allTypesList = this.createNewAllTypesList(initialId, setSize);
allTypesList.insertAll();
IntHashSet idSet = new IntHashSet(setSize);
IntHashSet otherSet = new IntHashSet(setSize);
otherSet.add(2000000000);
for(int i = 0; i < setSize; i++)
{
idSet.add(initialId+i);
otherSet.add(i);
}
AllTypesFinder.clearQueryCache();
Operation op = AllTypesFinder.id().in(idSet).and(AllTypesFinder.intValue().in(otherSet));
final AllTypesList list = new AllTypesList();
new AllTypesList(op).forEachWithCursor(new DoWhileProcedure()
{
@Override
public boolean execute(Object each)
{
list.add((AllTypes) each);
return true;
}
});
// String sql = "select * from ALL_TYPES where ID >= "+initialId;
// validateMithraResult(op, sql);
}
示例10: testYearTimestampRetrieval
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testYearTimestampRetrieval()
{
Operation eq = AllTypesFinder.timestampValue().year().eq(2007);
AllTypesList one = AllTypesFinder.findMany(eq);
int size = one.size();
assertEquals(10, size);
IntHashSet intSet = new IntHashSet();
intSet.add(2005);
intSet.add(2007);
Operation eq2 = TimestampConversionFinder.timestampValueNone().year().in(intSet);
TimestampConversionList one2 = TimestampConversionFinder.findMany(eq2);
int size2 = one2.size();
assertEquals(4, size2);
IntHashSet intSet2 = new IntHashSet();
intSet2.add(2005);
intSet2.add(2007);
Operation eq3 = TimestampConversionFinder.timestampValueUTC().year().in(intSet2);
TimestampConversionList one4 = TimestampConversionFinder.findMany(eq3);
int size4 = one4.size();
assertEquals(2, size4);
IntHashSet intSet3 = new IntHashSet();
intSet3.add(2005);
intSet3.add(2007);
Operation eq4 = TimestampConversionFinder.timestampValueDB().year().in(intSet3);
TimestampConversionList one5 = TimestampConversionFinder.findMany(eq4);
int size5 = one5.size();
assertEquals(3, size5);
}
示例11: testLargeInClauseInTransactionWithRollbackMonsterQuery
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testLargeInClauseInTransactionWithRollbackMonsterQuery()
{
final int initialId = 10000;
final int setSize = 5200;
AllTypesList allTypesList = this.createNewAllTypesList(initialId, setSize);
allTypesList.insertAll();
final IntHashSet idSet = new IntHashSet(setSize);
for(int i = 0; i < setSize; i++)
{
idSet.add(initialId+i);
}
try
{
MithraManagerProvider.getMithraManager().executeTransactionalCommand(
new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
assertEquals(5200, AllTypesFinder.findMany(AllTypesFinder.id().in(idSet)).size());
Operation op = AllTypesFinder.id().eq(initialId);
for(int i = 0; i < setSize; i++)
{
op = op.or(AllTypesFinder.id().eq(initialId+i).and(AllTypesFinder.nullableIntValue().eq(2000000000)));
}
assertEquals(5200, AllTypesFinder.findManyBypassCache(op).size());
fail("shouldn't get here; the previous stmt should make the database throw an exception");
return null;
}
}
);
}
catch(RuntimeException e)
{
// assertEquals("for testing rollback", e.getMessage());
}
}
示例12: timeLargeIn
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
private void timeLargeIn(int size, String type)
{
IntHashSet set = new IntHashSet(size);
for(int i=0;i<size;i++)
{
set.add(i+10000);
}
Operation op = ProductFinder.productId().in(set);
timeOperation(op, type+" with "+size+" params");
}
示例13: testAggregateBeanListWithLargeIn
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testAggregateBeanListWithLargeIn()
{
IntHashSet set = new IntHashSet();
for (int i = 0; i < 2000; i++)
{
set.add(i);
}
AggregateBeanList<SimpleAggregateBean> list = new AggregateBeanList<SimpleAggregateBean>(SalesLineItemFinder.itemId().in(set), SimpleAggregateBean.class);
list.addGroupBy("id", SalesLineItemFinder.manufacturerId());
list.addAggregateAttribute("totalQuantity", SalesLineItemFinder.quantity().sum());
assertEquals(2, list.size());
}
示例14: testDeleteAllPreCached
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void testDeleteAllPreCached()
{
OrderList list = new OrderList(OrderFinder.userId().eq(1));
IntHashSet deletedIds = new IntHashSet();
for(int i=0;i<list.size();i++)
{
deletedIds.add(list.getOrderAt(i).getOrderId());
}
list.deleteAll();
checkServerSideDeleted(deletedIds);
OrderList list2 = new OrderList(OrderFinder.userId().eq(1));
assertEquals(0, list2.size());
}
示例15: createOrdersAndItems
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
private IntHashSet createOrdersAndItems()
{
OrderList orderList = new OrderList();
for (int i = 0; i < 1100; i++)
{
Order order = new Order();
order.setOrderId(i+1000);
order.setDescription("order number "+i);
order.setUserId(i+7000);
order.setOrderDate(new Timestamp(System.currentTimeMillis()));
order.setTrackingId("T"+i+1000);
orderList.add(order);
}
orderList.bulkInsertAll();
OrderItemList items = new OrderItemList();
IntHashSet itemIds = new IntHashSet();
for (int i = 0; i < 1100; i++)
{
OrderItem item = new OrderItem();
item.setOrderId(i+1000);
item.setId(i+1000);
items.add(item);
item = new OrderItem();
item.setOrderId(i+1000);
item.setId(i+3000);
item.setProductId((i % 4) + 1);
items.add(item);
itemIds.add(i+1000);
itemIds.add(i+3000);
}
items.bulkInsertAll();
return itemIds;
}