Produced by Araxis Merge on 6/9/2017 3:49:56 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 9 19:49:56 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-common\src\main\java\gov\va\nvap\common\array | ArrayUtil.java | Fri Apr 21 20:03:26 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 82 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.nvap. common.arr ay; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 4 | ||||||
| 5 | import jav a.lang.ref lect.Array ; | |||||
| 6 | import jav a.util.Arr ayList; | |||||
| 7 | import jav a.util.Col lection; | |||||
| 8 | import jav a.util.Lis t; | |||||
| 9 | ||||||
| 10 | public cla ss ArrayUt il { | |||||
| 11 | ||||||
| 12 | /* * | |||||
| 13 | * Add to an array and if the ar ray is emp ty then cr eate a new array. | |||||
| 14 | * | |||||
| 15 | * @param <T > | |||||
| 16 | * the type | |||||
| 17 | * @param c | |||||
| 18 | * the list | |||||
| 19 | * @param e | |||||
| 20 | * the elem ent | |||||
| 21 | * @return t he list wi th the ele ment added | |||||
| 22 | * / | |||||
| 23 | pu blic stati c <T exten ds Object> List<T> s afeAdd(fin al List<T> c, final T e) { | |||||
| 24 | List <T> arrayL ist = c; | |||||
| 25 | if ( NullChecke r.isEmpty( c)) { | |||||
| 26 | arrayL ist = new ArrayList< T>(); | |||||
| 27 | } | |||||
| 28 | arra yList.add( e); | |||||
| 29 | retu rn arrayLi st; | |||||
| 30 | } | |||||
| 31 | ||||||
| 32 | /* * | |||||
| 33 | * UNSAFE - Use with c aution! 1. The colle ction cont ains one o r more | |||||
| 34 | * elements. 2. The fi rst elemen t is exact ly a T an not a subc lass there of. | |||||
| 35 | * | |||||
| 36 | * @param <T > | |||||
| 37 | * the type | |||||
| 38 | * @param <E > | |||||
| 39 | * the coll ection typ e | |||||
| 40 | * @param c | |||||
| 41 | * the coll ection | |||||
| 42 | * @return t he array | |||||
| 43 | * / | |||||
| 44 | @S uppressWar nings("all ") | |||||
| 45 | pu blic stati c <T, E ex tends T> T [] toArray (final Col lection<E> c) { | |||||
| 46 | if ( (c != null ) && (c.si ze() > 0)) { | |||||
| 47 | return c.toArray ((T[]) Arr ay.newInst ance(c.ite rator().ne xt() | |||||
| 48 | .getClass( ), c.size( ))); | |||||
| 49 | } | |||||
| 50 | retu rn null; | |||||
| 51 | } | |||||
| 52 | ||||||
| 53 | /* * | |||||
| 54 | * UNSAFE - Use with c aution! 1. The colle ction cont ains one o r more | |||||
| 55 | * elements. 2. The fi rst elemen t is exact ly a T an not a subc lass there of. | |||||
| 56 | * | |||||
| 57 | * @param <T > | |||||
| 58 | * the type | |||||
| 59 | * @param <E > | |||||
| 60 | * the coll ection typ e | |||||
| 61 | * @param c | |||||
| 62 | * the coll ection | |||||
| 63 | * @param co mponentTyp e | |||||
| 64 | * the type of array to constru ct | |||||
| 65 | * @return t he array | |||||
| 66 | * / | |||||
| 67 | @S uppressWar nings("all ") | |||||
| 68 | pu blic stati c <T, E ex tends T> T [] toArray (final Col lection<E> c, | |||||
| 69 | final Class<T> c omponentTy pe) { | |||||
| 70 | if ( (c != null ) && (c.si ze() > 0)) { | |||||
| 71 | return c.toArray ((T[]) Arr ay.newInst ance(compo nentType, c.size())) ; | |||||
| 72 | } | |||||
| 73 | retu rn null; | |||||
| 74 | } | |||||
| 75 | ||||||
| 76 | /* * | |||||
| 77 | * Default p rotected c onstructor . | |||||
| 78 | * / | |||||
| 79 | pr otected Ar rayUtil() { | |||||
| 80 | } | |||||
| 81 | ||||||
| 82 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.