How to verify if an object with a particular attribute value exists in an arraylist?












0















I would like to read through a a text document and then add only the unique words to the arraylist of "Word" objects. It appears that the code I have now does not enter any words at all into the wordList arraylist.



public ArrayList<Word> wordList = new ArrayList<Word>();
String fileName, word;
int counter;
Scanner reader = null;
Scanner scanner = new Scanner(System.in);

try {
reader = new Scanner(new FileInputStream(fileName));
}
catch(FileNotFoundException e) {
System.out.println("The file could not be found. The program will now exit.");
System.exit(0);
}

while (reader.hasNext()) {
word = reader.next().toLowerCase();
for (Word value : wordList) {
if(value.getValue().contains(word)) {
Word newWord = new Word(word);
wordList.add(newWord);
}
}
counter++;
}

public class Word {

String value;
int frequency;

public Word(String v) {
value = v;
frequency = 1;
}

public String getValue() {
return value;
}

public String toString() {
return value + " " + frequency;
}

}









share|improve this question























  • Override the equals method in Word and use a Set to contain the values.

    – flakes
    Nov 23 '18 at 18:39
















0















I would like to read through a a text document and then add only the unique words to the arraylist of "Word" objects. It appears that the code I have now does not enter any words at all into the wordList arraylist.



public ArrayList<Word> wordList = new ArrayList<Word>();
String fileName, word;
int counter;
Scanner reader = null;
Scanner scanner = new Scanner(System.in);

try {
reader = new Scanner(new FileInputStream(fileName));
}
catch(FileNotFoundException e) {
System.out.println("The file could not be found. The program will now exit.");
System.exit(0);
}

while (reader.hasNext()) {
word = reader.next().toLowerCase();
for (Word value : wordList) {
if(value.getValue().contains(word)) {
Word newWord = new Word(word);
wordList.add(newWord);
}
}
counter++;
}

public class Word {

String value;
int frequency;

public Word(String v) {
value = v;
frequency = 1;
}

public String getValue() {
return value;
}

public String toString() {
return value + " " + frequency;
}

}









share|improve this question























  • Override the equals method in Word and use a Set to contain the values.

    – flakes
    Nov 23 '18 at 18:39














0












0








0








I would like to read through a a text document and then add only the unique words to the arraylist of "Word" objects. It appears that the code I have now does not enter any words at all into the wordList arraylist.



public ArrayList<Word> wordList = new ArrayList<Word>();
String fileName, word;
int counter;
Scanner reader = null;
Scanner scanner = new Scanner(System.in);

try {
reader = new Scanner(new FileInputStream(fileName));
}
catch(FileNotFoundException e) {
System.out.println("The file could not be found. The program will now exit.");
System.exit(0);
}

while (reader.hasNext()) {
word = reader.next().toLowerCase();
for (Word value : wordList) {
if(value.getValue().contains(word)) {
Word newWord = new Word(word);
wordList.add(newWord);
}
}
counter++;
}

public class Word {

String value;
int frequency;

public Word(String v) {
value = v;
frequency = 1;
}

public String getValue() {
return value;
}

public String toString() {
return value + " " + frequency;
}

}









share|improve this question














I would like to read through a a text document and then add only the unique words to the arraylist of "Word" objects. It appears that the code I have now does not enter any words at all into the wordList arraylist.



public ArrayList<Word> wordList = new ArrayList<Word>();
String fileName, word;
int counter;
Scanner reader = null;
Scanner scanner = new Scanner(System.in);

try {
reader = new Scanner(new FileInputStream(fileName));
}
catch(FileNotFoundException e) {
System.out.println("The file could not be found. The program will now exit.");
System.exit(0);
}

while (reader.hasNext()) {
word = reader.next().toLowerCase();
for (Word value : wordList) {
if(value.getValue().contains(word)) {
Word newWord = new Word(word);
wordList.add(newWord);
}
}
counter++;
}

public class Word {

String value;
int frequency;

public Word(String v) {
value = v;
frequency = 1;
}

public String getValue() {
return value;
}

public String toString() {
return value + " " + frequency;
}

}






java arraylist






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 18:24









S. MillerS. Miller

176218




176218













  • Override the equals method in Word and use a Set to contain the values.

    – flakes
    Nov 23 '18 at 18:39



















  • Override the equals method in Word and use a Set to contain the values.

    – flakes
    Nov 23 '18 at 18:39

















Override the equals method in Word and use a Set to contain the values.

– flakes
Nov 23 '18 at 18:39





Override the equals method in Word and use a Set to contain the values.

– flakes
Nov 23 '18 at 18:39












3 Answers
3






active

oldest

votes


















2














Alright, let's start by fixing your current code. The issue you have is that you are only adding a new word object to the list when one already exists. Instead, you need to add a new Word object when none exist, and increment the frequency otherwise. Here is an example fix for that:



    ArrayList<Word> wordList = new ArrayList<Word>();
String fileName, word;
Scanner reader = null;
Scanner scanner = new Scanner(System.in);

try {
reader = new Scanner(new FileInputStream(fileName));
}
catch(FileNotFoundException e) {
System.out.println("The file could not be found. The program will now exit.");
System.exit(0);
}

while (reader.hasNext()) {
word = reader.next().toLowerCase();
boolean wordExists = false;
for (Word value : wordList) {
// We have seen the word before so increase frequency.
if(value.getValue().equals(word)) {
value.frequency++;
wordExists = true;
break;
}
}
// This is the first time we have seen the word!
if (!wordExists) {
Word newValue = new Word(word);
newValue.frequency = 1;
wordList.add(newValue);
}
}
}


However, this is a really bad solution (O(n^2) runtime). Instead we should be using datastructure known as a Map which will bring our runtime down to (O(n))



    ArrayList<Word> wordList = new ArrayList<Word>();
String fileName, word;
int counter;
Scanner reader = null;
Scanner scanner = new Scanner(System.in);

try {
reader = new Scanner(new FileInputStream(fileName));
}
catch(FileNotFoundException e) {
System.out.println("The file could not be found. The program will now exit.");
System.exit(0);
}
Map<String, Integer> frequencyMap = new HashMap<String, Integer>();
while (reader.hasNext()) {
word = reader.next().toLowerCase();
// This is equivalent to searching every word in the list via hashing (O(1))
if(!frequencyMap.containsKey(word)) {
frequencyMap.put(word, 1);
} else {
// We have already seen the word, increase frequency.
frequencyMap.put(word, frequencyMap.get(word) + 1);
}
}

// Convert our map of word->frequency to a list of Word objects.
for(Map.Entry<String, Integer> entry : frequencyMap.entrySet()) {
Word word = new Word(entry.getKey());
word.frequency = entry.getValue();
wordList.add(word);
}
}





share|improve this answer
























  • Awesome solution, thanks so much. Never seen this Map thing but looks really neat.

    – S. Miller
    Nov 24 '18 at 19:01



















0














Your for-each loop is iterating over wordList, but that is an empty ArrayList so your code will never reach the wordList.add(newWord); line






share|improve this answer































    0














    I appreciate that perhaps you wanted critique on why your algorithm wasn't working, or maybe it was an example of a much larger problem but if all you want to do is count occurences, there is a much simpler way of doing this.



    Using Streams in Java 8 you can boil this down to one method - create a Stream of the lines in the file, lowercase them and then use a Collector to count them.



    public static void main(final String args) throws IOException
    {
    final File file = new File(System.getProperty("user.home") + File.separator + "Desktop" + File.separator + "myFile.txt");

    for (final Entry<String, Long> entry : countWordsInFile(file).entrySet())
    {
    System.out.println(entry);
    }
    }

    public static Map<String, Long> countWordsInFile(final File file) throws IOException
    {
    return Files.lines(file.toPath()).map(String::toLowerCase).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
    }


    I've not done anything with Streams until now so any critique welcome.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451435%2fhow-to-verify-if-an-object-with-a-particular-attribute-value-exists-in-an-arrayl%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      Alright, let's start by fixing your current code. The issue you have is that you are only adding a new word object to the list when one already exists. Instead, you need to add a new Word object when none exist, and increment the frequency otherwise. Here is an example fix for that:



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }

      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      boolean wordExists = false;
      for (Word value : wordList) {
      // We have seen the word before so increase frequency.
      if(value.getValue().equals(word)) {
      value.frequency++;
      wordExists = true;
      break;
      }
      }
      // This is the first time we have seen the word!
      if (!wordExists) {
      Word newValue = new Word(word);
      newValue.frequency = 1;
      wordList.add(newValue);
      }
      }
      }


      However, this is a really bad solution (O(n^2) runtime). Instead we should be using datastructure known as a Map which will bring our runtime down to (O(n))



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      int counter;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }
      Map<String, Integer> frequencyMap = new HashMap<String, Integer>();
      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      // This is equivalent to searching every word in the list via hashing (O(1))
      if(!frequencyMap.containsKey(word)) {
      frequencyMap.put(word, 1);
      } else {
      // We have already seen the word, increase frequency.
      frequencyMap.put(word, frequencyMap.get(word) + 1);
      }
      }

      // Convert our map of word->frequency to a list of Word objects.
      for(Map.Entry<String, Integer> entry : frequencyMap.entrySet()) {
      Word word = new Word(entry.getKey());
      word.frequency = entry.getValue();
      wordList.add(word);
      }
      }





      share|improve this answer
























      • Awesome solution, thanks so much. Never seen this Map thing but looks really neat.

        – S. Miller
        Nov 24 '18 at 19:01
















      2














      Alright, let's start by fixing your current code. The issue you have is that you are only adding a new word object to the list when one already exists. Instead, you need to add a new Word object when none exist, and increment the frequency otherwise. Here is an example fix for that:



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }

      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      boolean wordExists = false;
      for (Word value : wordList) {
      // We have seen the word before so increase frequency.
      if(value.getValue().equals(word)) {
      value.frequency++;
      wordExists = true;
      break;
      }
      }
      // This is the first time we have seen the word!
      if (!wordExists) {
      Word newValue = new Word(word);
      newValue.frequency = 1;
      wordList.add(newValue);
      }
      }
      }


      However, this is a really bad solution (O(n^2) runtime). Instead we should be using datastructure known as a Map which will bring our runtime down to (O(n))



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      int counter;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }
      Map<String, Integer> frequencyMap = new HashMap<String, Integer>();
      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      // This is equivalent to searching every word in the list via hashing (O(1))
      if(!frequencyMap.containsKey(word)) {
      frequencyMap.put(word, 1);
      } else {
      // We have already seen the word, increase frequency.
      frequencyMap.put(word, frequencyMap.get(word) + 1);
      }
      }

      // Convert our map of word->frequency to a list of Word objects.
      for(Map.Entry<String, Integer> entry : frequencyMap.entrySet()) {
      Word word = new Word(entry.getKey());
      word.frequency = entry.getValue();
      wordList.add(word);
      }
      }





      share|improve this answer
























      • Awesome solution, thanks so much. Never seen this Map thing but looks really neat.

        – S. Miller
        Nov 24 '18 at 19:01














      2












      2








      2







      Alright, let's start by fixing your current code. The issue you have is that you are only adding a new word object to the list when one already exists. Instead, you need to add a new Word object when none exist, and increment the frequency otherwise. Here is an example fix for that:



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }

      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      boolean wordExists = false;
      for (Word value : wordList) {
      // We have seen the word before so increase frequency.
      if(value.getValue().equals(word)) {
      value.frequency++;
      wordExists = true;
      break;
      }
      }
      // This is the first time we have seen the word!
      if (!wordExists) {
      Word newValue = new Word(word);
      newValue.frequency = 1;
      wordList.add(newValue);
      }
      }
      }


      However, this is a really bad solution (O(n^2) runtime). Instead we should be using datastructure known as a Map which will bring our runtime down to (O(n))



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      int counter;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }
      Map<String, Integer> frequencyMap = new HashMap<String, Integer>();
      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      // This is equivalent to searching every word in the list via hashing (O(1))
      if(!frequencyMap.containsKey(word)) {
      frequencyMap.put(word, 1);
      } else {
      // We have already seen the word, increase frequency.
      frequencyMap.put(word, frequencyMap.get(word) + 1);
      }
      }

      // Convert our map of word->frequency to a list of Word objects.
      for(Map.Entry<String, Integer> entry : frequencyMap.entrySet()) {
      Word word = new Word(entry.getKey());
      word.frequency = entry.getValue();
      wordList.add(word);
      }
      }





      share|improve this answer













      Alright, let's start by fixing your current code. The issue you have is that you are only adding a new word object to the list when one already exists. Instead, you need to add a new Word object when none exist, and increment the frequency otherwise. Here is an example fix for that:



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }

      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      boolean wordExists = false;
      for (Word value : wordList) {
      // We have seen the word before so increase frequency.
      if(value.getValue().equals(word)) {
      value.frequency++;
      wordExists = true;
      break;
      }
      }
      // This is the first time we have seen the word!
      if (!wordExists) {
      Word newValue = new Word(word);
      newValue.frequency = 1;
      wordList.add(newValue);
      }
      }
      }


      However, this is a really bad solution (O(n^2) runtime). Instead we should be using datastructure known as a Map which will bring our runtime down to (O(n))



          ArrayList<Word> wordList = new ArrayList<Word>();
      String fileName, word;
      int counter;
      Scanner reader = null;
      Scanner scanner = new Scanner(System.in);

      try {
      reader = new Scanner(new FileInputStream(fileName));
      }
      catch(FileNotFoundException e) {
      System.out.println("The file could not be found. The program will now exit.");
      System.exit(0);
      }
      Map<String, Integer> frequencyMap = new HashMap<String, Integer>();
      while (reader.hasNext()) {
      word = reader.next().toLowerCase();
      // This is equivalent to searching every word in the list via hashing (O(1))
      if(!frequencyMap.containsKey(word)) {
      frequencyMap.put(word, 1);
      } else {
      // We have already seen the word, increase frequency.
      frequencyMap.put(word, frequencyMap.get(word) + 1);
      }
      }

      // Convert our map of word->frequency to a list of Word objects.
      for(Map.Entry<String, Integer> entry : frequencyMap.entrySet()) {
      Word word = new Word(entry.getKey());
      word.frequency = entry.getValue();
      wordList.add(word);
      }
      }






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 23 '18 at 18:44









      AlchemyAlchemy

      4253




      4253













      • Awesome solution, thanks so much. Never seen this Map thing but looks really neat.

        – S. Miller
        Nov 24 '18 at 19:01



















      • Awesome solution, thanks so much. Never seen this Map thing but looks really neat.

        – S. Miller
        Nov 24 '18 at 19:01

















      Awesome solution, thanks so much. Never seen this Map thing but looks really neat.

      – S. Miller
      Nov 24 '18 at 19:01





      Awesome solution, thanks so much. Never seen this Map thing but looks really neat.

      – S. Miller
      Nov 24 '18 at 19:01













      0














      Your for-each loop is iterating over wordList, but that is an empty ArrayList so your code will never reach the wordList.add(newWord); line






      share|improve this answer




























        0














        Your for-each loop is iterating over wordList, but that is an empty ArrayList so your code will never reach the wordList.add(newWord); line






        share|improve this answer


























          0












          0








          0







          Your for-each loop is iterating over wordList, but that is an empty ArrayList so your code will never reach the wordList.add(newWord); line






          share|improve this answer













          Your for-each loop is iterating over wordList, but that is an empty ArrayList so your code will never reach the wordList.add(newWord); line







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 18:47









          Joe DegiovanniJoe Degiovanni

          5036




          5036























              0














              I appreciate that perhaps you wanted critique on why your algorithm wasn't working, or maybe it was an example of a much larger problem but if all you want to do is count occurences, there is a much simpler way of doing this.



              Using Streams in Java 8 you can boil this down to one method - create a Stream of the lines in the file, lowercase them and then use a Collector to count them.



              public static void main(final String args) throws IOException
              {
              final File file = new File(System.getProperty("user.home") + File.separator + "Desktop" + File.separator + "myFile.txt");

              for (final Entry<String, Long> entry : countWordsInFile(file).entrySet())
              {
              System.out.println(entry);
              }
              }

              public static Map<String, Long> countWordsInFile(final File file) throws IOException
              {
              return Files.lines(file.toPath()).map(String::toLowerCase).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
              }


              I've not done anything with Streams until now so any critique welcome.






              share|improve this answer




























                0














                I appreciate that perhaps you wanted critique on why your algorithm wasn't working, or maybe it was an example of a much larger problem but if all you want to do is count occurences, there is a much simpler way of doing this.



                Using Streams in Java 8 you can boil this down to one method - create a Stream of the lines in the file, lowercase them and then use a Collector to count them.



                public static void main(final String args) throws IOException
                {
                final File file = new File(System.getProperty("user.home") + File.separator + "Desktop" + File.separator + "myFile.txt");

                for (final Entry<String, Long> entry : countWordsInFile(file).entrySet())
                {
                System.out.println(entry);
                }
                }

                public static Map<String, Long> countWordsInFile(final File file) throws IOException
                {
                return Files.lines(file.toPath()).map(String::toLowerCase).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
                }


                I've not done anything with Streams until now so any critique welcome.






                share|improve this answer


























                  0












                  0








                  0







                  I appreciate that perhaps you wanted critique on why your algorithm wasn't working, or maybe it was an example of a much larger problem but if all you want to do is count occurences, there is a much simpler way of doing this.



                  Using Streams in Java 8 you can boil this down to one method - create a Stream of the lines in the file, lowercase them and then use a Collector to count them.



                  public static void main(final String args) throws IOException
                  {
                  final File file = new File(System.getProperty("user.home") + File.separator + "Desktop" + File.separator + "myFile.txt");

                  for (final Entry<String, Long> entry : countWordsInFile(file).entrySet())
                  {
                  System.out.println(entry);
                  }
                  }

                  public static Map<String, Long> countWordsInFile(final File file) throws IOException
                  {
                  return Files.lines(file.toPath()).map(String::toLowerCase).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
                  }


                  I've not done anything with Streams until now so any critique welcome.






                  share|improve this answer













                  I appreciate that perhaps you wanted critique on why your algorithm wasn't working, or maybe it was an example of a much larger problem but if all you want to do is count occurences, there is a much simpler way of doing this.



                  Using Streams in Java 8 you can boil this down to one method - create a Stream of the lines in the file, lowercase them and then use a Collector to count them.



                  public static void main(final String args) throws IOException
                  {
                  final File file = new File(System.getProperty("user.home") + File.separator + "Desktop" + File.separator + "myFile.txt");

                  for (final Entry<String, Long> entry : countWordsInFile(file).entrySet())
                  {
                  System.out.println(entry);
                  }
                  }

                  public static Map<String, Long> countWordsInFile(final File file) throws IOException
                  {
                  return Files.lines(file.toPath()).map(String::toLowerCase).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
                  }


                  I've not done anything with Streams until now so any critique welcome.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 23 '18 at 20:49









                  JakgJakg

                  405311




                  405311






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451435%2fhow-to-verify-if-an-object-with-a-particular-attribute-value-exists-in-an-arrayl%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Costa Masnaga

                      Fotorealismo

                      Sidney Franklin