Create a small list from a bigger list, on some criteria

I have a list of java objects, i want to create small list on some criteria for some calculation, so i dont have to loop through all the big list, but create a small list,
what is the best way to do so, i can loop through the big list and then add objects that match the criteria to another list, but is there any other way, like using comparator or some thing any ideas
here is some code for reference
public class Mybean {
private id ;
private name;
private lastname;
//getters and setters
}This is the big list, which may have 1000 objects, and then i want to create a small list where id = 123, then do some calculation,
what is the best way, i am using this loop to create it
for(Mybean mybean: biglist){
if(mybean.getId = 123){
smallListId.add(mybean);
}

If you're going to do this a lot, I'd suggest writing something like:
class Filter<T> {
  List<T> filter(Match<T> matcher, List<T> inputToBeFiltered);
  interface Match<T> {
    public boolean matches(T);
}

Similar Messages

  • I am being forced to create 3 security question from your dropdown list and I can choose the questions but can't enter anything in the answer field??

    I am being forced to create 3 security question from your dropdown list and I can choose the questions but can't enter anything in the answer field??

    The problem is twenty three people leaving or twenty three thousand leaving has zero impact on a carrier with over 100 million customers. And they have the lowest churn rate. So if 10,000 or 20,000 or more churn out it means little to the carrier.
    If you have a real lawyer he/she will advise you that you have no case. The device was not lost or stolen by the carrier, you were not eligible for a new device, and like any business who employs large numbers of poorly trained personnel who make low wages what was told to you is not in writing. So a verbal exchange does not hold up.
    In fact in Verizon's customer agreement it has such a disclaimer against any verbal exchanges so if you have that agreement in writing, go get them.
    The posting on public forums and places like Face Book, Linkin, Google+ or a personal web site can open you up to a lawsuit for Dilution of Trade Name, and other offences. However if you have proof then go for it.
    Unfortunately that is how big business works today. A pity

  • TFS Workitems:Bugs : I want ot select different lists, from the global list, for fields basd upon user group

    Hi,
    I am customizing the bug workitem workflow.
     I want ot select different lists, from the gllobal list, for fields basd upon user group
    I am aware that I can use "when" clauses in the allowed/suggested values of the field.
    My question is : how do I get the group(s) that the current user is in and how do use this to select different lists?

    Hi!
    You can not do this through standard way. You must to create the custom work item control:
    http://witcustomcontrols.codeplex.com/
    And get the user group through IIdentityManagementService.
    IIdentityManagementService IdentityService = _workItem.Store.TeamProjectCollection.GetService<IIdentityManagementService>();
    TeamFoundationIdentity _curid = null;
    _workItem.Store.TeamProjectCollection.GetAuthenticatedIdentity(out _curid);
    string _group = "Admin";
    var _gr = IdentityService.ReadIdentity(IdentitySearchFactor.AccountName, _group, MembershipQuery.Direct, ReadIdentityOptions.None);
    if (_gr.Members.Where(s => s.Identifier == _curid.Descriptor.Identifier).Count() > 0) return true;

  • Remove all entries in sub csv list from parent csv list?

    I have two csv files, one is a complete (parent) list, the other is a sub list. I want to remove all sub-list entires from the parent list. Without manually removing each entry from the parent list one at a time, is there an effecient way to remove all sub list entries from parent list in one simple effort?
    Each list contains email addresses, I want to exclude the sub list from the parent list for the next mailing as they have already completed an action.
    Example:
    Parent list (csv1) has A, B, C, D, E
    Sub list (csv2) has B, D
    How can I remove B & D from Parent list in a concise action?
    Thanks!

    Hi smashart,
    Ian has given you a method that requires manual removal of the unwanted values from the Parent list. My preference would be for a method that constructs a new sub list that includes only the items wanted, but does not affect the original parent list data.
    Like Ian's method, this requires opening both the parent list and the existing sub list of addreses not wanted as separate tables in the same Numbers document.
    Here's an example:
    Two formulas are required.
    Parent::C2, and filled down: =IF(COUNTIF('Sub 1 (have acted)' :: $A,B2)>0,"",MAX($C$1:C1)+1)
    This creates the index shown in column C of Parent. This column may be hidden.
    Sub 2::A2, and filled down: =IF(ROW()-1>MAX(Parent :: $C),"",LOOKUP(ROW()-1,Parent :: $C,Parent :: $B))
    This uses LOOKUP to copy the indexed addresses to Sub 2.
    (Note: Close examination of the addresses in Sub 1 will show a repeated address. As can be seen, this does not affect its removal from the list in Sub 2.
    Regards,
    Barry

  • Can you have two detail lists from the basic list at the same time?

    Hi
    Can you have two detail lists from the basic list at the same time?
    If yes how and if no why?
    Thanks
    Venkat

    No   ... it is not   possible   of   2 detail  list at   one time   from the basic  list ...
    you can  increament   the SY-LSIND  .... But you can not   display  both the windows   at single time  ...
    it is  possible  to  display  2 Detail list  in ALV   ......  from one  basic  list   using  the  Blocked  list  concept    .
    Sample Program on BLOCK LISTS
    Report   zblock_list
    * Declarations for BLOCK ALV DISPLAY
    *--type pools
    TYPE-POOLS:slis.
    DATA:x_layout TYPE slis_layout_alv,
    t_field TYPE slis_t_fieldcat_alv,
    *--field catalog
    x_fldcat LIKE LINE OF t_field,
    *--to hold all the events
    t_events TYPE slis_t_event,
    x_events TYPE slis_alv_event,
    t_sort TYPE slis_t_sortinfo_alv,
    x_sort LIKE LINE OF t_sort ,
    *--Print Layout
    x_print_layout TYPE slis_print_alv.
    *----Macro to add field catalog.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    DEFINE add_catalog.
    clear x_fldcat.
    x_fldcat-fieldname = &1.
    x_fldcat-seltext_m = &2.
    x_fldcat-outputlen = &3.
    x_fldcat-tech = &4.
    x_fldcat-col_pos = &5.
    x_fldcat-no_zero = 'X'.
    x_fldcat-ddictxt = 'M'.
    x_fldcat-datatype = &6.
    x_fldcat-ddic_outputlen = &7.
    if &6 = 'N'.
    x_fldcat-lzero = 'X'.
    endif.
    *--build field catalog
    append x_fldcat to t_field.
    END-OF-DEFINITION.
    *----- data declerations.
    data: v_repid like sy-repid.
    data: begin of itab occurs 0,
    matnr like mara-matnr,
    ernam like mara-ernam,
    meins like mara-meins,
    end of itab.
    data: begin of jtab occurs 0,
    matnr like makt-matnr,
    maktx like makt-maktx,
    end of jtab.
    select matnr ernam meins
    up to 20 rows
    from mara
    into table itab.
    select matnr maktx
    up to 20 rows
    from makt
    into table jtab.
    v_repid = sy-repid.
    *DISPLAY alv
    * Initialize Block
    call function 'REUSE_ALV_BLOCK_LIST_INIT'
    exporting
    i_callback_program = v_repid.
    *Block 1:
    *INITIALIZE
    refresh t_field. clear t_field.
    refresh t_events.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    add_catalog:
    'MATNR' 'Material' '18' '' '1' 'C' '18',
    'ERNAM' 'Created By' '12' '' '2' 'C' '12',
    'MEINS' 'Unit' '5' '' '3' 'C' '3'.
    *--build table for events.
    x_events-form = 'TOP_OF_LIST1'.
    x_events-name = slis_ev_top_of_list.
    append x_events to t_events.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = x_layout
    it_fieldcat = t_field
    i_tabname = 'ITAB'
    it_events = t_events
    it_sort = t_sort
    tables
    t_outtab = itab
    exceptions
    program_error = 1
    maximum_of_appends_reached = 2
    others = 3.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *--BLOCK 2(SUMMARY REPORT)
    *INITIALIZE
    refresh t_field. clear t_field.
    refresh t_events.
    *field "text "length "tech "COL_POS "DATATYPE "DDIC_OUTPUTLEN
    add_catalog:
    'MATNR' 'Material' '20' '' '1' 'C' '18',
    'MAKTX' 'Description' '40' '' '2' 'C' '40'.
    *--build table for events.
    x_events-form = 'TOP_OF_LIST2'.
    x_events-name = slis_ev_top_of_list.
    append x_events to t_events.
    * Append table block.
    call function 'REUSE_ALV_BLOCK_LIST_APPEND'
    exporting
    is_layout = x_layout
    it_fieldcat = t_field
    i_tabname = 'JTAB'
    it_events = t_events
    tables
    t_outtab = jtab
    exceptions
    program_error = 1
    maximum_of_appends_reached = 2
    others = 3.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    *--CALL FM TO DISPLAY THE BLOCK REPORT.
    call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    * exporting
    * is_print = x_print_layout
    exceptions
    program_error = 1
    others = 2.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    form top_of_list1.
    skip 1.
    write: 10 'List 1',
    /5 '--------------------'.
    skip 1.
    format reset.
    endform.
    form top_of_list2.
    skip 1.
    write: 10 'List 2',
    /5 '--------------------'.
    skip 1.
    format reset.
    endform.
    reward  points if it is  usefull ....
    Girish

  • How to delete a list from the reading list

    How to delete a list from the reading list

    I assume that you mean in Safari, in which case just swipe across it's name in reading list and you should get a Delete button appear on it.

  • HT1692 why does my ipad not pick up distribution lists from my contacts list?

    why does my ipad not pick up distribution lists from my contacts list?

    What is selected under the Music tab for your iPhone sync preferences with iTunes?

  • I created two Aperture libraries from one large library. Some of the photos in library

    I created two Aperture libraries from one large library. Some of the photos I want to keep in library #2 are in the trash of library #1.  If I empty the trash of library #1, will it affect the same photos that were moved to library #2?  I moved over 2,000 photos to create library #2.  Their names are showing in the trash of library #1. 

    Are your images referenced or managed? If your partial libraries are referencing the same original files as the library you exported them from, be careful. Deleting the orignal on one library #1can delete it from the  library #2. But if your originals are managed by Aperture inside the Aperture library, you can delete them.
    I moved over 2,000 photos to create library #2.  Their names are showing in the trash of library #1.
    If you are not sure about referenced or managed, select one of the images you want to keep in the library where they are not in the Trash, then use the command "File > Show in Finder". If you can reveal them in the Finder, they are referenced and probably are shared between your libraries.
    Or turn on "badge referenced files" in the Preferences > Appearance settings. Then your referenced images will show arrow badges.

  • Create png/ultimately .gif from a file list

    I have a number of images in my site that I would like to
    create a label (gif) for.
    i.e. filename=george.jpg I'd like to create a small gif to
    insert under the image that says "george".
    I have used file monkey to get a list of all my images.... is
    there a fast/easy way to get 1 gif for every image?
    Thanks!!!

    There are many ways to remove the white background.
    You might try using the magic wand tool to select the white, press delete to remove the white background then use File>Save for Web.
    If there is still some of the white remaining around the logo, either use a layer mask from your selection and clean up the edges or try
    Layer>Matting>Defringe and then save the file.
    You might use png-24 in the save for web if you want quality over file size.

  • Need to create an edit Page from a Multiselect List

    I make one or more selections of values from a Multiselect List; I need to branch to another page in which I display all of the selected List items and two other columns (per item) that can be edited; i.e., this second page will look like one or more rows consisting of (1) List item, (2) value1 from a Table, (3) value2 from a Table. I need to be able to change value1 and/or value2 for any or all of the rows and have those changes reflected in the Database. (The List item is display only).
    My question is: which construction wizard can I use for this second page? I can collect my List items in a PL/SQL Table, but how can I display them and their related columns so the column values are editable?

    Thanks for the reply. I understand how to create Collections with the values I need to display and modify; however, I'm unsure which construction Wizard to employ to launch the Page ("Form based upon a Procedure", etc.)
    I looked in the Tutorials for a "collection demo" and found these potential candidates: "Build an Issue Tracking System", "Create a Simple Survey Application", and "Serving Application Express Reports". Is it one of these? If not, please tell me where I can find the "collection demo". Thanks.

  • Create a Delivery note from a picking List and many binallocations

    Hi,
    Recently, I get how create a delivery note form a picking list with batchnumbers, but now I have the following case.
    Quantity       Product       SerialAndBatchNumbersBaseLine
    10                ID200                              0   
    5                  ID200                              1
    now I set the batchNumbers
    location    batchnumber       quantity
    02-A              XY                   10
    02-B              YY                    5    <---    this location give me error.
    now the rest of articles
    Quantity       Product       SerialAndBatchNumbersBaseLine
    10                ID200                              0   
    5                  ID200                              1
    location    batchnumber       quantity
    02-A              XY                   10
    02-B              XY                    5  
    etc.
    I get the next error:
    1470000344 - Batch "YY" of item "ID200" in bin location "3108" falls into negative inventory.
    When I find this "3108" this "select * from OBIN where AbsEntry = 3108" is the batchnumber for XY and not YY.
    so how is the way to create a delivery note with many binallocations? 
    (if required I will paste code.)
    Kind regards,
    Pablo

    Hi Pablo,
    based on the code from the other thread it should be like that for the first row:
    delivery.Lines.ItemCode = "ID200";
    delivery.Lines.Quantity = 15;
    delivery.Lines.BinAllocations.BinAbsEntry = 3107; // guessed AbsEntry
    delivery.Lines.BinAllocations.Quantity = 10;
    delivery.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
    delivery.Lines.BinAllocations.Add();
    delivery.Lines.BinAllocations.BinAbsEntry = 3108;
    delivery.Lines.BinAllocations.Quantity = 5;
    delivery.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 1;
    delivery.Lines.BatchNumbers.Location = "02-A";
    delivery.Lines.BatchNumbers.BatchNumber = "XY";
    delivery.Lines.BatchNumbers.Quantity = 10;
    delivery.Lines.BatchNumbers.Add();
    delivery.Lines.BatchNumbers.Location = "02-B";
    delivery.Lines.BatchNumbers.BatchNumber = "YY";
    delivery.Lines.BatchNumbers.Quantity = 5;  
    You got now :
    1 Delivery Row, Quantity 15
    2 BinLoc Rows, Quantity 10+5
    2 Batch Rows, Quantity 10+5
    regards,
    Maik

  • SharePoint 2013 Document Library template displays html code when creating a new document from a sharepoint list multiline rich text

    I have a 2010 work flow that is associated with a sharepoint 2013 list that creates a new list document using a custom Microsoft Word 2013 template with a rich text multiline field quick part.  The workflow creates the document and populates
    the the quickpart, however, the text in the document is showing html codes
    <div class="ExternalClass2116495984EB429D95B02CC15F85FD4C"><h1>ABC123</h1><h2>Test&#58; 1234</h2></div>
    and not as 
    ABC123
    Test: 1234
    Is there a no code solution for this?

    Hi,
    I have done a test and I can reproduced your issue.
    I referred to the blog about Automatically create Word documents which include list fields:
    http://blogs.technet.com/b/brenclarke/archive/2009/04/15/automatically-create-word-documents-which-include-list-fields.aspx
    When I create a multiple line of text column in a list, I just choose Plain text, Then I solved the issue:
    Besides, here is a similar post, you can take a look at:
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/a7ab3a61-6643-4a47-a464-fe46b5db1558/rich-text-field-showing-html-code
    Best Regards,
    Lisa Chen
    Lisa Chen
    TechNet Community Support

  • Creating an order form from a sharepoint list

    Hello- I need to create an order form that shows my entire sharepoint list and allows the user to select the items he/she wants and put qty's next to them. Is this possible?
    I see how to add the list into my form as a dropdown allowing me to select each on individually but i would like them all to be displayed.
    I am using infopath 2007.
    thanks - Casey

    Hello,
    You first need to create custom list in sharepoint (if not created yet) and save data into it. Later you need to add a data connection in form to connect your list with infopath form.
    Now you can bind the data with dropwdown or bind with repeating table to show all (just drag and drop the connection on form). later you can add one checkbox in repeating table so user can select the data whatever they want.
    Refer this link to drag and drop data connection as repeating table:
    http://www.enjoysharepoint.com/Articles/Details/show-sharepoint-list-data-in-repeating-table-in-infopath-2010-377.aspx#.U3rnLSjcCHM
    Refer this for checkbox:
    http://www.bizsupportonline.net/infopath2010/how-to-check-all-check-boxes-repeating-table-infopath-2010.htm
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • To Construct An Array Of Smaller Holograms From A Bigger One.

    Hi,
    Here I am attaching my LabVIEW VI where I need some help.
    The VI attached generates a hologram of dimension 512x512.
    With this dimension I need to construct an array of 4x4 holograms
    each of dimension 128x128 with different mx and my value(for each)  and place them
    side by side to form a 4x4 hologram matrix (So, that now I have a total 16 smaller holograms each of dimension 128x128 placed in an array of dimension 4x4).
    I don't know how to do this in LabVIEW. It will really be a great help for me if anyone helps me out here.
    Thanks!
    Attachments:
    Hologram Generation.vi ‏20 KB

    related thred
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Copy small array from cyclical queue

    Hi,
    I would like to know how to create a small array from a bigger one when the bigger one is cyclical. The problem is that i'm copying the values with Arrays.copyOfRange(array,from,to) until I end up to the final of the queue where it falls in a ArrayIndexOutOfBoundsException
    Example:
    cyclical_queue: [ 34 23 2 3 4 5]
    if small_array has to be [4 5 34] i cannot use copyOfRange since it would end up in Arrays.copyOfRange(cyclical_queue,4,1) -> ArrayIndexOutOfBoundsException
    P.S. I am trying to do it without loops since performance is important in my program
    Thanks in advance for any help,
    Rodo

    Rodo1983 wrote:
    I would like to know how to create a small array from a bigger one when the bigger one is cyclical. The problem is that i'm copying the values with Arrays.copyOfRange(array,from,to) until I end up to the final of the queue where it falls in a ArrayIndexOutOfBoundsExceptionYou can't use Arrays.copyOfRange for this if the array you're copying wraps around the end of the queue.
    P.S. I am trying to do it without loops since performance is important in my programDon't bother. Looping isn't inefficient, and besides, I'm almost positive Array.copyOfRange() uses loops. Just start copying at the beginning index, wrapping to zero if you get to the end, and stop when you get to the ending index.

Maybe you are looking for