Inner Join two Array of integer.

Discussion in 'Java' started by rdj1712, Nov 1, 2017.

  1. rdj1712

    rdj1712

    Joined:
    Nov 1, 2017
    Messages:
    2
    Likes Received:
    1
    For instance giving two arrays, [1,2,3], [3,3,4], output
    [3,4], The implementation must handle
    duplicates in either of the input arrays.
     
    rdj1712, Nov 1, 2017
    #1
    1. Advertisements

  2. rdj1712

    John Joe

    Joined:
    Apr 25, 2017
    Messages:
    59
    Likes Received:
    11
    Location:
    Malaysia
    What have you tried ? You can get solution from internet
     
    John Joe, Nov 1, 2017
    #2
    1. Advertisements

  3. rdj1712

    rdj1712

    Joined:
    Nov 1, 2017
    Messages:
    2
    Likes Received:
    1
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.List;

    public class arraytest{

    public static void main(String[] args)
    {
    Integer[] array1 = { 1,2,3,4};
    Integer[] array2 = {3,3,4};


    List<Integer> joins = new ArrayList<Integer>(Arrays.asList(array1));
    joins.retainAll(Arrays.asList(array2));

    System.out.println("Inner Join: " + joins);

    }
    }
     
    rdj1712, Nov 1, 2017
    #3
    John Joe likes this.
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Gareth Stretch
    Replies:
    0
    Views:
    5,432
    Gareth Stretch
    Jun 26, 2003
  2. Gene Ariani
    Replies:
    0
    Views:
    2,934
    Gene Ariani
    Aug 21, 2003
  3. Carlo v. Dango
    Replies:
    14
    Views:
    1,495
    Alex Martelli
    Oct 19, 2003
  4. Tim Chase
    Replies:
    6
    Views:
    395
    Michael J. Fromberger
    Feb 28, 2006
  5. Pyenos
    Replies:
    2
    Views:
    728
    Pyenos
    Dec 27, 2006
  6. the chad

    I cannot get this inner join to work in asp

    the chad, Aug 8, 2003, in forum: ASP General
    Replies:
    3
    Views:
    200
    The Chad
    Aug 11, 2003
  7. Jeff Uchtman

    HELP! Left, Right, Inner Join

    Jeff Uchtman, Apr 7, 2004, in forum: ASP General
    Replies:
    0
    Views:
    257
    Jeff Uchtman
    Apr 7, 2004
  8. Robin

    Inner Join question

    Robin, Apr 20, 2004, in forum: ASP General
    Replies:
    2
    Views:
    260
    Roland Hall
    Apr 20, 2004
Loading...