Java Code Examples for java.util.ArrayList#toString()
The following examples show how to use
java.util.ArrayList#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormulaResult.java From microMathematics with GNU General Public License v3.0 | 6 votes |
private String fillResultString() { if (resultType == ResultType.NAN) { return TermParser.CONST_NAN; } if (resultType == ResultType.CONSTANT) { constantResult.convertUnit(TermParser.parseUnits(properties.units), /*toBase=*/ true); return constantResult.getResultDescription(getFormulaList().getDocumentSettings()); } if (isArrayResult()) { final ArrayList<ArrayList<String>> res = fillResultMatrixArray(); if (res != null) { return res.toString(); } } return ""; }
Example 2
Source File: TokenSecuredResource.java From quarkus-quickstarts with Apache License 2.0 | 6 votes |
@GET @Path("winners2") @Produces(MediaType.TEXT_PLAIN) @RolesAllowed("Subscriber") public String winners2() { int remaining = 6; ArrayList<Integer> numbers = new ArrayList<>(); // If the JWT contains a birthdate claim, use the day of the month as a pick if (birthdate.isPresent()) { String bdayString = birthdate.get().getString(); LocalDate bday = LocalDate.parse(bdayString); numbers.add(bday.getDayOfMonth()); remaining--; } // Fill remaining picks with random numbers while (remaining > 0) { int pick = (int) Math.rint(64 * Math.random() + 1); numbers.add(pick); remaining--; } return numbers.toString(); }
Example 3
Source File: Test.java From jeecg-boot-with-activiti with MIT License | 6 votes |
@Override public String toString() { LinkedList<TreeNode> list = new LinkedList<>(); list.offer(this); ArrayList<Integer> res = new ArrayList<>(); while (!list.isEmpty()) { TreeNode node = list.poll(); res.add(node.val); if (node.left != null) { list.offer(node.left); } if (node.right != null) { list.offer(node.right); } } return res.toString(); }
Example 4
Source File: AppliedFilter.java From cuba with Apache License 2.0 | 5 votes |
protected String formatParamValue(Param param) { Object value = param.getValue(); if (value == null) return ""; if (param.isDateInterval()) { DateIntervalValue dateIntervalValue = AppBeans.getPrototype(DateIntervalValue.NAME, (String) value); return dateIntervalValue.getLocalizedValue(); } if (value instanceof Instance) return ((Instance) value).getInstanceName(); if (value instanceof Enum) return messages.getMessage((Enum) value); if (value instanceof ArrayList){ ArrayList<String> names = new ArrayList<>(); ArrayList list = ((ArrayList) value); for (Object obj : list) { if (obj instanceof Instance) names.add(((Instance) obj).getInstanceName()); else { names.add(FilterConditionUtils.formatParamValue(param, obj)); } } return names.toString(); } return FilterConditionUtils.formatParamValue(param, value); }
Example 5
Source File: MBeanTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
private static void checkForErrors() { ArrayList<String> errorList = (ArrayList<String>) SQLBB.getBB().getSharedMap().get("DATA_ERROR"); if (errorList != null && errorList.size() > 0) { errorList.add(0, "Errors (" + errorList.size() + ") were found:\n"); throw new TestException(errorList.toString()); } else { Log.getLogWriter().info("*** No Errors Were Found! Congrats, now go celebrate! ***"); } }
Example 6
Source File: TranslatorHelper.java From cqf-ruler with Apache License 2.0 | 5 votes |
public static String errorsToString(Iterable<CqlTranslatorException> exceptions) { ArrayList<String> errors = new ArrayList<>(); for (CqlTranslatorException error : exceptions) { TrackBack tb = error.getLocator(); String lines = tb == null ? "[n/a]" : String.format("%s[%d:%d, %d:%d]", (tb.getLibrary() != null ? tb.getLibrary().getId() + (tb.getLibrary().getVersion() != null ? ("-" + tb.getLibrary().getVersion()) : "") : ""), tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar()); errors.add(lines + error.getMessage()); } return errors.toString(); }
Example 7
Source File: JVMCIError.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static String format(String msg, Object... args) { if (args != null) { // expand Iterable parameters into a list representation for (int i = 0; i < args.length; i++) { if (args[i] instanceof Iterable<?>) { ArrayList<Object> list = new ArrayList<>(); for (Object o : (Iterable<?>) args[i]) { list.add(o); } args[i] = list.toString(); } } } return String.format(Locale.ENGLISH, msg, args); }
Example 8
Source File: GraalError.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static String format(String msg, Object... args) { if (args != null) { // expand Iterable parameters into a list representation for (int i = 0; i < args.length; i++) { if (args[i] instanceof Iterable<?>) { ArrayList<Object> list = new ArrayList<>(); for (Object o : (Iterable<?>) args[i]) { list.add(o); } args[i] = list.toString(); } } } return String.format(Locale.ENGLISH, msg, args); }
Example 9
Source File: GerenciadorDeConta.java From dctb-utfpr-2018-1 with Apache License 2.0 | 5 votes |
public String listarContas() { ArrayList<String> list = new ArrayList(); for (Iterator iterator = contas.iterator(); iterator.hasNext();) { Conta c = (Conta) iterator.next(); list.add(c.toString()); } return list.toString(); }
Example 10
Source File: NBTChecker_v1_8_R3.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
public String getPotionType(String s) { ArrayList<String> t = new ArrayList<String>(); byte[] testBytes = Base64Coder.decode(s); ByteArrayInputStream buf = new ByteArrayInputStream(testBytes); try { NBTTagCompound tag = NBTCompressedStreamTools.a(buf); Set<String> keys = tag.c(); for (String key : keys) { String b = tag.get(key).toString(); String[] arr = b.split(","); for(int c = 0; c < arr.length; c++){ //System.out.println("SOMETHING IN A LOOP ? " + arr[c]); if(arr[c].contains("minecraft:")){ return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", ""); } } } } catch (Exception ex) { ex.printStackTrace(); } return t.toString(); }
Example 11
Source File: JoinNode.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static String[] getTableColumnDetails(ResultSetNode rs) throws StandardException { final ArrayList<String> tables = new ArrayList<String>(); VisitorAdaptor findLeftTables = new VisitorAdaptor() { @Override public Visitable visit(Visitable node) throws StandardException { if (node instanceof FromTable) { tables.add("{" + ((FromTable)node).getCorrelationName() + " " + ((FromTable)node).getOrigTableName() + "}"); } return node; } }; rs.accept(findLeftTables); String involvedTables = tables.toString(); String[] leftRSColumns = rs.resultColumns.getColumnNames(); String[] rsColumnsWithTables = new String[leftRSColumns.length + 1]; rsColumnsWithTables[0] = involvedTables; System.arraycopy(leftRSColumns, 0, rsColumnsWithTables, 1, leftRSColumns.length); return rsColumnsWithTables; }
Example 12
Source File: KeyedVec3dInput.java From jaamsim with Apache License 2.0 | 5 votes |
private void parseKey(JaamSimModel simModel, ArrayList<String> key) throws InputErrorException { if (key.size() <= 2 || !key.get(0).equals("{") || !key.get(key.size()-1).equals("}")) { throw new InputErrorException("Malformed key entry: %s", key.toString()); } ArrayList<ArrayList<String>> keyEntries = InputAgent.splitForNestedBraces(key.subList(1, key.size()-1)); if (keyEntries.size() != 2) { throw new InputErrorException("Expected two values in keyed input for key entry: %s", key.toString()); } ArrayList<String> timeInput = keyEntries.get(0); ArrayList<String> valInput = keyEntries.get(1); // Validate if (timeInput.size() != 4 || !timeInput.get(0).equals("{") || !timeInput.get(timeInput.size()-1).equals("}")) { throw new InputErrorException("Time entry not formated correctly: %s", timeInput.toString()); } if (valInput.size() != 6 || !valInput.get(0).equals("{") || !valInput.get(valInput.size()-1).equals("}")) { throw new InputErrorException("Value entry not formated correctly: %s", valInput.toString()); } KeywordIndex timeKw = new KeywordIndex("", timeInput, 1, 3, null); DoubleVector time = Input.parseDoubles(simModel, timeKw, 0.0d, Double.POSITIVE_INFINITY, TimeUnit.class); KeywordIndex valKw = new KeywordIndex("", valInput, 1, 5, null); DoubleVector vals = Input.parseDoubles(simModel, valKw, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, unitType); Vec3d val = new Vec3d(vals.get(0), vals.get(1), vals.get(2)); curve.addKey(time.get(0), val); }
Example 13
Source File: NBTChecker_v1_12_R1.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
public String getPotionType(String s) { //HashMap<String, String> ke = new HashMap<String, String>(); ArrayList<String> t = new ArrayList<String>(); byte[] testBytes = Base64Coder.decode(s); ByteArrayInputStream buf = new ByteArrayInputStream(testBytes); try { NBTTagCompound tag = NBTCompressedStreamTools.a(buf); Set<String> keys = tag.c(); for (String key : keys) { // System.out.println(key); String b = tag.get(key).toString(); //System.out.println(b); String[] arr = b.split(","); for(int c = 0; c < arr.length; c++){ //System.out.println("SOMETHING IN A LOOP ? " + arr[c]); if(arr[c].contains("minecraft:")){ return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", ""); } } } } catch (Exception ex) { ex.printStackTrace(); } return t.toString(); }
Example 14
Source File: JoinNode.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
protected static String[] getTableColumnDetails(ResultSetNode rs) throws StandardException { final ArrayList<String> tables = new ArrayList<String>(); VisitorAdaptor findLeftTables = new VisitorAdaptor() { @Override public Visitable visit(Visitable node) throws StandardException { if (node instanceof FromTable) { tables.add("{" + ((FromTable)node).getCorrelationName() + " " + ((FromTable)node).getOrigTableName() + "}"); } return node; } }; rs.accept(findLeftTables); String involvedTables = tables.toString(); String[] leftRSColumns = rs.resultColumns.getColumnNames(); String[] rsColumnsWithTables = new String[leftRSColumns.length + 1]; rsColumnsWithTables[0] = involvedTables; System.arraycopy(leftRSColumns, 0, rsColumnsWithTables, 1, leftRSColumns.length); return rsColumnsWithTables; }
Example 15
Source File: NBTChecker_v1_9_R1.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
public String getPotionType(String s) { //HashMap<String, String> ke = new HashMap<String, String>(); ArrayList<String> t = new ArrayList<String>(); byte[] testBytes = Base64Coder.decode(s); ByteArrayInputStream buf = new ByteArrayInputStream(testBytes); try { NBTTagCompound tag = NBTCompressedStreamTools.a(buf); Set<String> keys = tag.c(); for (String key : keys) { // System.out.println(key); String b = tag.get(key).toString(); //System.out.println(b); String[] arr = b.split(","); for(int c = 0; c < arr.length; c++){ //System.out.println("SOMETHING IN A LOOP ? " + arr[c]); if(arr[c].contains("minecraft:")){ return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", ""); } } } } catch (Exception ex) { ex.printStackTrace(); } return t.toString(); }
Example 16
Source File: NBTChecker_v1_10_R1.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
public String getPotionType(String s) { //HashMap<String, String> ke = new HashMap<String, String>(); ArrayList<String> t = new ArrayList<String>(); byte[] testBytes = Base64Coder.decode(s); ByteArrayInputStream buf = new ByteArrayInputStream(testBytes); try { NBTTagCompound tag = NBTCompressedStreamTools.a(buf); Set<String> keys = tag.c(); for (String key : keys) { // System.out.println(key); String b = tag.get(key).toString(); //System.out.println(b); String[] arr = b.split(","); for(int c = 0; c < arr.length; c++){ //System.out.println("SOMETHING IN A LOOP ? " + arr[c]); if(arr[c].contains("minecraft:")){ return arr[c].replace("minecraft:", "").replace('"', ' ').replace(" ", ""); } } } } catch (Exception ex) { ex.printStackTrace(); } return t.toString(); }
Example 17
Source File: OrchestrationServiceHandler.java From SO with BSD 2-Clause "Simplified" License | 4 votes |
/** * OrchestrationService handler.<BR/> * * @param orchestrationService IGenericOrchestrationService */ public void handle(IGenericOrchestrationService orchestrationService) { String osId, osName, osResult; getTracking().setProcess(getClass().getSimpleName()); if (orchestrationService != null) { osId = orchestrationService.getId(); osName = orchestrationService.getName(); osResult = "CONTROL_EXECUTION"; } else { osId = null; osName = null; osResult = "CONTROL_IGNORE"; } // grib session SessionEntity sessionOs = new SessionEntity(); sessionOs.setId(getTracking().getSessionId()); sessionOs.setServicemodelKey(osId); sessionOs.setServicemodelName(osName); sessionOs.setServicemodelResult(osResult); databaseManager.updateSessionData(sessionOs); log.trace("session service : {}", sessionOs); // OS list : os 를 복수로 확장하게 될 경우 사용 // if (orchestrationService.getOrchestrationServiceList() != null) { // handleOrchestrationServiceList(orchestrationService.getOrchestrationServiceList() // , orchestrationService.getStateStore()); // } // os id 로 Rule body 목록을 조회한다 log.debug("getRuleBodyListByOsId : {}", osId); List<RuleBodyForDB> ruleBodyForDBList = databaseManager.getRuleBodyListByOsId(osId); //convert to List<IGenericCompositeVirtualObject> List<IGenericCompositeVirtualObject> cvoList = new ArrayList<>(); for (RuleBodyForDB rubleBodyItem:ruleBodyForDBList) { DefaultCompositeVirtualObject compositeVirtualObject = new DefaultCompositeVirtualObject(); compositeVirtualObject.setId(rubleBodyItem.getId()); //cvo_type, physical_device_type_id, device_id compositeVirtualObject.setCvoType(rubleBodyItem.getCvoType()); compositeVirtualObject.setPhysicalDeviceTypeId(rubleBodyItem.getPhysicalDeviceTypeId()); compositeVirtualObject.setDeviceId(rubleBodyItem.getDeviceId()); //base_cvo_id, location_id compositeVirtualObject.setBaseCvoId(rubleBodyItem.getBaseCvoId()); compositeVirtualObject.setLocationId(rubleBodyItem.getLocationId()); compositeVirtualObject.setOsId(rubleBodyItem.getOsId()); cvoList.add(compositeVirtualObject); } if (cvoList != null && cvoList.size()>0) { ArrayList<String> cvoIdList= new ArrayList<>(); for (int i=0; i< cvoList.size();i++) { IGenericCompositeVirtualObject cvo = cvoList.get(i); //cvoIdList.add(cvo.getId()); cvoIdList.add(cvo.getBaseCvoId()); } String cvoIds= cvoIdList.toString(); String cvoResult = "CONTROL_EXECUTION"; sessionOs = new SessionEntity(); sessionOs.setId(getTracking().getSessionId()); sessionOs.setServiceKey(cvoIds); sessionOs.setServiceResult(cvoResult); databaseManager.updateSessionData(sessionOs); handleCompositeVirtualObjectList(cvoList, orchestrationService.getStateStore()); } else { // cvo 목록이 없는 경우에 Happend처리 SessionEntity sessionCm = new SessionEntity(); sessionCm.setId(getTracking().getSessionId()); sessionCm.setContextmodelResult("Happen"); //Session Data는 완료 처리 databaseManager.updateSessionData(sessionCm); } }
Example 18
Source File: CuboidSchedulerTest.java From Kylin with Apache License 2.0 | 4 votes |
private String sortToString(Collection<Long> longs) { ArrayList<Long> copy = new ArrayList<Long>(longs); Collections.sort(copy); return copy.toString(); }
Example 19
Source File: SQLDistTxTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") /* * returns true: when no conflict expected and commit does not gets conflict * exception retruns false: when conflict is expected and commit correctly * failed with conflict exception */ protected boolean verifyBatchingConflictAtCommit(boolean firstCommit, SQLException se, boolean getsConflict) { // find the keys has been hold by others hydra.blackboard.SharedMap modifiedKeysByAllTx = SQLTxBatchingBB.getBB() .getSharedMap(); HashMap<String, Integer> modifiedKeysByThisTx = (HashMap<String, Integer>) SQLDistTxTest.curTxModifiedKeys .get(); Integer myTxId = (Integer) curTxId.get(); // will be used for mix RC and RR case /* * SharedMap writeLockedKeysByRRTx = null; Map writeLockedKeysByOtherRR = * null; * * SharedMap readLockedKeysByRRTx = null; Map readLockedKeysByOtherRR = * null; */ boolean expectFKConflict = expectBatchingFKConflict(modifiedKeysByAllTx .getMap()); if (!getsConflict) { if (firstCommit && expectFKConflict) { throw new TestException( "commit with batching " + "should get conflict exception but not, need to check log for foreing key constraints"); } } // remove those keys are already held by this tx for (String key : modifiedKeysByThisTx.keySet()) { // log().info("this tx hold the key: " + key); ArrayList<Integer> txIdsForTheKey = (ArrayList<Integer>) modifiedKeysByAllTx .get(key); boolean contains = txIdsForTheKey.remove(myTxId); if (!contains) throw new TestException( "test issue, a key is not added in the batchingBB map"); if (txIdsForTheKey.size() > 0) { if (!getsConflict) throw new TestException("commit with batching " + "should get conflict exception but not, for key: " + key + ", there are following other txId hold the" + " lock locally: " + txIdsForTheKey.toString()); else { Log.getLogWriter().info("get expected conflict exception during commit"); return false; } } } // no other txId has the same key could cause conflict // txIdsForTheKey.size()==0 for all holding keys if (getsConflict) { if (expectFKConflict) { Log.getLogWriter().info("get expected conflict exception during commit"); return false; } else { throw new TestException( "does not expect a conflict during commit, but gets " + TestHelper.getStackTrace(se)); // TODO this needs to be revisited depends on how #48195 is being // handled by product // if the first commit should fail, need to find out a way to // check a later op causes the foreign key conflict // a possible way is to have every op could cause foreign key conflict // writes // the conflicting txId to BB, so the conflict could be checked here. // (when batching is on) // and BB needs to be cleaned after conflict exception is thrown, } } else { if (!expectFKConflict) return true; else { throw new TestException( "should get a conflict during commit, but does not. Need to check logs for more info"); } } }
Example 20
Source File: UserDataDBHelper.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 4 votes |
private void deserializeHighlightsAndSave(@NonNull String serializedHighlights, @NonNull PageInfo pageInfo, int bookId) { ArrayList<ContentValues> highlights = Highlight.deserializeToContentValues(serializedHighlights, pageInfo, bookId); ArrayList<Integer> existingHighlightsId = new ArrayList<>(highlights.size()); for (ContentValues highlight_current : highlights) { existingHighlightsId .add(highlight_current.getAsInteger(UserDataDBContract.HighlightEntry.COLUMN_NAME_HIGHLIGHT_ID)); } String existingHighlightsIdString = existingHighlightsId.toString(); existingHighlightsIdString = existingHighlightsIdString.replace('[', '('); existingHighlightsIdString = existingHighlightsIdString.replace(']', ')'); SQLiteDatabase db = getWritableDatabase(); db.beginTransaction(); try { if (highlights.size() != 0) { db.delete(UserDataDBContract.HighlightEntry.TABLE_NAME, UserDataDBContract.HighlightEntry.COLUMN_NAME_BOOK_ID + "=?" + " and " + UserDataDBContract.HighlightEntry.COLUMN_NAME_PAGE_ID + "=?" + " and " + UserDataDBContract.HighlightEntry.COLUMN_NAME_HIGHLIGHT_ID + " NOT IN " + existingHighlightsIdString, new String[]{String.valueOf(bookId), String.valueOf(pageInfo.pageId)} ); } else { db.delete(UserDataDBContract.HighlightEntry.TABLE_NAME, UserDataDBContract.HighlightEntry.COLUMN_NAME_BOOK_ID + "=?" + " and " + UserDataDBContract.HighlightEntry.COLUMN_NAME_PAGE_ID + "=?", new String[]{String.valueOf(bookId), String.valueOf(pageInfo.pageId)} ); } for (ContentValues highlight : highlights) { db.insertWithOnConflict( UserDataDBContract.HighlightEntry.TABLE_NAME, null, highlight, SQLiteDatabase.CONFLICT_IGNORE); } db.setTransactionSuccessful(); } catch (SQLException e) { Timber.e("deserializeHighlightsAndSave: ", e); } finally { db.endTransaction(); } }