java - How to read data line by line from String buffer and match with another String -


itemprop = "text">

I write code

  public class keys {personal constant last string} keyss = { "HGDLV-KLLQC-DM3ON-MAUOX-FNQK5", "HQKLD-NYRDL-NJXCV-BVCKF-NRKLC", "LDFCV-BDJCQ-VMFQV-FNRKC-NFCFL" // and many more}; Public static string getKey (string key) {boolean B = Arrays.asList (keyss) .contains (key); If (b == true) {key = "accepted"; } Other {key = "unapproved"; } Return key; }  

and all strings are accepted even if the user specified string

Use parallel to the strings Additionally, the implementation of GetKeys () is very complex and redundant. Consider changing it:

  Public square key {Private Static Last String [key = {"HGDLV-KLWC-DM3-NMUOX -FNQK5 "," HQKLD-NYRDL-NJXCV-BVCKF-NRKLC "," LDFCV-BDJCQ-VMFQV-FNRKC-NFCFL "// and many more}; Public static string getKey {string (current key: {key} {if (current.equals (key)) {return "approved"; }} Return "Disapproved"; }}  

is not required, and neither a Boolean switch ..

You can check out to compare the stars to read out.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -