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


Java ArrayList.get方法代碼示例

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


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

示例1: findDropTarget

import java.util.ArrayList; //導入方法依賴的package包/類
private DropTarget findDropTarget(int x, int y, int[] dropCoordinates) {
    final Rect r = mRectTemp;

    final ArrayList<DropTarget> dropTargets = mDropTargets;
    final int count = dropTargets.size();
    for (int i=count-1; i>=0; i--) {
        DropTarget target = dropTargets.get(i);
        if (!target.isDropEnabled())
            continue;

        target.getHitRectRelativeToDragLayer(r);

        mDragObject.x = x;
        mDragObject.y = y;
        if (r.contains(x, y)) {

            dropCoordinates[0] = x;
            dropCoordinates[1] = y;
            mLauncher.getDragLayer().mapCoordInSelfToDescendent((View) target, dropCoordinates);

            return target;
        }
    }
    return null;
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:26,代碼來源:DragController.java

示例2: encodeDecodeShortListWithTwoByteArraysWithElementsLength56

import java.util.ArrayList; //導入方法依賴的package包/類
@Test
public void encodeDecodeShortListWithTwoByteArraysWithElementsLength56() {
    byte[] value1 = new byte[26];
    byte[] value2 = new byte[28];
    byte[] element1 = RLP.encodeElement(value1);
    byte[] element2 = RLP.encodeElement(value2);
    byte[] encoded = RLP.encodeList(element1, element2);

    Assert.assertNotNull(encoded);
    Assert.assertEquals(1 + 1 + 1 + 26 + 1 + 28, encoded.length);
    Assert.assertEquals((byte)(247 + 1), encoded[0]);
    Assert.assertEquals((byte)(56), encoded[1]);

    ArrayList<RLPElement> list = RLP.decode2(encoded);

    Assert.assertNotNull(list);
    Assert.assertEquals(1, list.size());

    RLPList list2 = (RLPList) list.get(0);

    Assert.assertNotNull(list2);
    Assert.assertEquals(2, list2.size());
    Assert.assertArrayEquals(value1, list2.get(0).getRLPData());
    Assert.assertArrayEquals(value2, list2.get(1).getRLPData());
}
 
開發者ID:rsksmart,項目名稱:rskj,代碼行數:26,代碼來源:RLPTest.java

示例3: updateItemsInDatabaseHelper

import java.util.ArrayList; //導入方法依賴的package包/類
static void updateItemsInDatabaseHelper(Context context, final ArrayList<ContentValues> valuesList,
        final ArrayList<ItemInfo> items, final String callingFunction) {
    final ContentResolver cr = context.getContentResolver();

    final StackTraceElement[] stackTrace = new Throwable().getStackTrace();
    Runnable r = new Runnable() {
        public void run() {
            ArrayList<ContentProviderOperation> ops =
                    new ArrayList<ContentProviderOperation>();
            int count = items.size();
            for (int i = 0; i < count; i++) {
                ItemInfo item = items.get(i);
                final long itemId = item.id;
                final Uri uri = LauncherSettings.Favorites.getContentUri(itemId);
                ContentValues values = valuesList.get(i);

                ops.add(ContentProviderOperation.newUpdate(uri).withValues(values).build());
                updateItemArrays(item, itemId, stackTrace);

            }
            try {
                cr.applyBatch(LauncherProvider.AUTHORITY, ops);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };
    runOnWorkerThread(r);
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:30,代碼來源:LauncherModel.java

示例4: prepareMonoPixelMap

import java.util.ArrayList; //導入方法依賴的package包/類
private void prepareMonoPixelMap() {
	int[] row_cache = null;
	final int line = rgbData.length;
	final int column = rgbData[0].length;
	ArrayList<Point> al = new ArrayList<Point>();

	// Point first = null;

	for (int y = 0; y < line; y++) {
		row_cache = rgbData[y];
		for (int x = 0; x < column; x++)
			if (row_cache[x] == monoColor)
				al.add(new Point(x, y));
	}

	monoXY_Map = new int[2][al.size()];
	for (int i = 0; i < al.size(); i++) {
		Point p = (Point) al.get(i);
		monoXY_Map[0][i] = (int) p.getX();
		monoXY_Map[1][i] = (int) p.getY();
	}
	rgbData = null;
}
 
開發者ID:1Ridav,項目名稱:PengueeBot,代碼行數:24,代碼來源:FragMono.java

示例5: isFixedView

import java.util.ArrayList; //導入方法依賴的package包/類
public boolean isFixedView(View v) {
    int i;
    ArrayList<FixedViewInfo> where = this.mHeaderViewInfos;
    int len = where.size();
    for (i = 0; i < len; i++) {
        if (((FixedViewInfo) where.get(i)).view == v) {
            return true;
        }
    }
    where = this.mFooterViewInfos;
    len = where.size();
    for (i = 0; i < len; i++) {
        if (((FixedViewInfo) where.get(i)).view == v) {
            return true;
        }
    }
    return false;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:19,代碼來源:PLA_ListView.java

示例6: requestPermissions

import java.util.ArrayList; //導入方法依賴的package包/類
private boolean requestPermissions() throws PackageManager.NameNotFoundException {
    PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_PERMISSIONS);
    ArrayList<String> toRequest = new ArrayList<>();
    if (info.requestedPermissions != null) {
        for (String p : info.requestedPermissions) {
            if (ContextCompat.checkSelfPermission(this, p) != PackageManager.PERMISSION_GRANTED) {
                toRequest.add(p);
            }
        }
    }

    if (toRequest.size() > 0) {
        String[] tra = new String[toRequest.size()];
        for (int i = 0; i < tra.length; i++) {
            tra[i] = toRequest.get(i);
        }
        ActivityCompat.requestPermissions(this, tra, PERMISSION_RESULT);
    }
    return toRequest.size() == 0;
}
 
開發者ID:timstableford,項目名稱:P-BrainAndroid,代碼行數:21,代碼來源:MainActivity.java

示例7: moveItemsInDatabase

import java.util.ArrayList; //導入方法依賴的package包/類
/**
 * Move items in the DB to a new <container, screen, cellX, cellY>. We assume that the
 * cellX, cellY have already been updated on the ItemInfos.
 */
public void moveItemsInDatabase(final ArrayList<ItemInfo> items, long container, int screen) {
    ArrayList<ContentValues> contentValues = new ArrayList<>();
    int count = items.size();

    for (int i = 0; i < count; i++) {
        ItemInfo item = items.get(i);
        updateItemInfoProps(item, container, screen, item.cellX, item.cellY);

        final ContentValues values = new ContentValues();
        values.put(Favorites.CONTAINER, item.container);
        values.put(Favorites.CELLX, item.cellX);
        values.put(Favorites.CELLY, item.cellY);
        values.put(Favorites.RANK, item.rank);
        values.put(Favorites.SCREEN, item.screenId);

        contentValues.add(values);
    }
    mWorkerExecutor.execute(new UpdateItemsRunnable(items, contentValues));
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:24,代碼來源:ModelWriter.java

示例8: getPathToRoot

import java.util.ArrayList; //導入方法依賴的package包/類
private TreeNode[] getPathToRoot(TreeNode aNode) {
    TreeNode[] retNodes;
    ArrayList<TreeNode> temp = new ArrayList<TreeNode>();

    /* Check for null, in case someone passed in a null node, or
    they passed in an element that isn't rooted at root. */
    while (aNode != null) {
        temp.add(aNode);
        aNode = aNode.getParent();
    }

    int num = temp.size();
    retNodes = new TreeNode[num];
    for (int i = num - 1; i >= 0; i--) {
        retNodes[num - 1 - i] = temp.get(i);
    }

    return retNodes;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:CheckTreeSelectionModel.java

示例9: calTotalValores

import java.util.ArrayList; //導入方法依賴的package包/類
private static void calTotalValores(ArrayList<Object[]> list) {
    Double valor;
    valoresTotal = new String[list.get(0).length];
    for (Object[] value : list) {
        for (int j = 0; j < value.length; j++) {
            for (int k = 0; k < arrValoresTotal.length; k++) {
                if (j == arrValoresTotal[k]) {
                    System.err.println(value[j]);
                    valor = ((valoresTotal[j] == null) ? 0.0 : Moeda.unFormat(valoresTotal[j].replaceAll(" ", "").replaceAll(",", ".").replaceAll("STD", "")));
                    valor += Moeda.unFormat(toString(value[j]).replaceAll(" ", "").replaceAll(",", ".").replaceAll("STD", ""));
                    valoresTotal[j] = Moeda.format(valor);
                }
            }
        }
    }

    if (!Arrays.toString(arrValoresTotal).contains("0")) {
        valoresTotal[0] = "TOTAL";
    }

    list.add(valoresTotal);
}
 
開發者ID:JIGAsoftSTP,項目名稱:NICON,代碼行數:23,代碼來源:GenericPDFs.java

示例10: getFragment

import java.util.ArrayList; //導入方法依賴的package包/類
private static BaseFragment getFragment(ArrayList<Fragment> fragments
            , int position, FragmentCreator fragmentCreator){
        Fragment fragment  = fragments.get(position);
        if(fragment == null){
            fragment = fragmentCreator.createFragment();
//            Logger.d("create fragment " + fragment + (Math.random() * 1000 * 1000));
        }else{
//            Logger.d("reuse fragment" + fragment + (Math.random() * 1000 * 1000));
        }
        return (BaseFragment) fragment;
    }
 
開發者ID:ThirtyDegreesRay,項目名稱:OpenHub,代碼行數:12,代碼來源:FragmentPagerModel.java

示例11: initOverflowItems

import java.util.ArrayList; //導入方法依賴的package包/類
void initOverflowItems() {

		ArrayList<String> menus = getMenuList();
		if (mItems == null) {
			int siz = menus.size();
			if (siz == 0) {
				return;
			}
			mItems = new OverflowAdapter.OverflowItem[siz];
		}
		for (int i = 0; i < mItems.length; i++) {
			mItems[i] = new OverflowAdapter.OverflowItem(menus.get(i));
		}

	}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:16,代碼來源:AppMenuActivity.java

示例12: fillNamesAndPoints

import java.util.ArrayList; //導入方法依賴的package包/類
private static void fillNamesAndPoints(ArrayList<String> Stack, ArrayList<Double> Points)
{
	for (int i = 0; i < Stack.size(); i++)
	{
		String p = (Points.get(i)).toString();
		String s = (Stack.get(i));
		String together = s + "     " + p;
		NamesAndPoints.add(together);
	}
}
 
開發者ID:CoffeeCodeSwitzerland,項目名稱:Lernkartei_2017,代碼行數:11,代碼來源:Rangliste.java

示例13: _readAndApplyThemeFromHtmlLine

import java.util.ArrayList; //導入方法依賴的package包/類
private void _readAndApplyThemeFromHtmlLine(ArrayList<String> htmlLines) {
    for (int i = 0; i < htmlLines.size(); i++) {
        String htmlLine = htmlLines.get(i);
        htmlLine = this._getHtmlLineAfterReadingProperties(htmlLine);
        htmlLines.set(i, htmlLine);
    }
}
 
開發者ID:zunayedhassan,項目名稱:email-newsletter-generator,代碼行數:8,代碼來源:EmailTemplateMakerProgram.java

示例14: onHandleIntent

import java.util.ArrayList; //導入方法依賴的package包/類
@Override
protected void onHandleIntent(@Nullable Intent intent) {
    Log.v(TAG, "onHandleIntent");
    Geocoder geocoder = new Geocoder(this, Locale.getDefault());
    String errorMessage = "";
    // Get the location passed to this service through an extra.
    ArrayList<GitHubUserLocationDataEntry> locationsList = intent.getParcelableArrayListExtra(
            LocationConstants.LOCATION_DATA_EXTRA);
    ResultReceiver mReceiver = intent.getParcelableExtra(
            LocationConstants.RECEIVER);
    try {
        for (int i = 0; i < locationsList.size(); i++) {
            GitHubUserLocationDataEntry entry = locationsList.get(i);
            List<Address> addressList = geocoder.getFromLocationName(entry.getLocation(), 1);
            if (!addressList.isEmpty()) {
                Address address = addressList.get(0);
                entry.setLatitude(address.getLatitude());
                entry.setLongitude(address.getLongitude());
            }
        }
    } catch (IOException ioException) {
        // Catch network or other I/O problems.
        errorMessage = getString(R.string.service_not_available);
        Log.e(TAG, errorMessage, ioException);
    } catch (IllegalArgumentException illegalArgumentException) {
        // Catch invalid latitude or longitude values.
        errorMessage = getString(R.string.invalid_lat_long_used);
        Log.e(TAG, errorMessage, illegalArgumentException);
    }
    Bundle bundle = new Bundle();
    bundle.putParcelableArrayList(LocationConstants.LOCATION_DATA_EXTRA, locationsList);
    mReceiver.send(0, bundle);
}
 
開發者ID:OlgaKuklina,項目名稱:GitJourney,代碼行數:34,代碼來源:FetchAddressIntentService.java

示例15: processImageDisplayUrl

import java.util.ArrayList; //導入方法依賴的package包/類
public static ArrayList<String> processImageDisplayUrl(
		ArrayList<String> imgs) {
		ArrayList<String> ret=new ArrayList<String>();
		
	for(int i=0;i<imgs.size();i++){
		String img=imgs.get(i);
		if(img.indexOf("http")==0){
			ret.add(img);
		}else{
			ret.add("file://"+img);
		}
	}
	return ret;
}
 
開發者ID:Louis19910615,項目名稱:youkes_browser,代碼行數:15,代碼來源:ImageUtil.java


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