当前位置: 首页>>代码示例>>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;未经允许,请勿转载。