I am trying to make a method that takes in an ArrayList and a letter. If the words in the arraylist start with that letter, than it will be put into a new array of words that start with that letter. For example, an arraylist with ("Apple", "Anny", "Bob") and a letter of "A" would create a new arraylist ("Apple", "Anny"). I am not allowed to use .startsWith(char ch)  public ArrayList&lt;String&gt; wordsThatStartWith(ArrayList&lt;String&gt; words, String letter) {     ArrayList&lt;String&gt; newWords = new ArrayList&lt;String&gt;();     for(int i = 0; i &lt; words.size(); i++){         if((words.get(i)).substring(i, i + 1) == letter){         newWords.add(words.get(i));     } } return newWords; }   I am not sure why it will not add into a new ArrayList.
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
When did Tom Riddle get his new face? Recently I asked about the  pertaining to Voldemorts new face. However I was corrected by ...     Well, I think the confusion comes with mixing movie canon with book canon. In Philosopher's Stone, here's what Harry sees when Quirrell unwraps his turban:           Harry would have screamed, but he couldn’t make a sound. Where there should have been a back to Quirrell’s head, there was a face, the most terrible face Harry had ever seen. It was chalk white with glaring red eyes and slits for nostrils, like a snake.          Philosopher's Stone - page 212 - UK - chapter 17, The Man With Two Faces      So it seems at some point between leaving school, and sticking his face to the back of Quirrel's head possessing Quirrel he got a new face some how.   How did he manage that? Is it some dark magic he applies? Is it from possessing snakes in Albania? Is there any gold standard for modeling irregularly spaced time series? How is the equation of motion on an ellipse derived? I would like to show that a particle orbiting another will follow the trajectory   \begin{equation} r = \frac{a(1-e^2)}{1 + e \cos(\theta)}. \end{equation}  I would like to do this with minimal assumptions. Any pointers? I've read that this is nothing but the equation for an ellipse, as defined from the focus of the ellipse. But I'm not satisfied in just taking the result, I mean why should I assume that orbits are elliptical? I guess it should be derivable from energy and angular momentum considerations... In  (ignoring Hawking radiation), why is a  black? Why nothing, not even light, can escape from inside a black hole? To make the question simpler, say, why is a  black hole black? I would like to look at my referral traffic over time on a per domain-basis in Google Analytics. This is what I have done:   Set New visits as advanced segment  Navigated to traffic-sources -> Referrals Checked a coulple of domains Clicked plot rows   The individual domains now show up in the graph, but the problem is that "all traffic" is also visible. All traffic is much bigger than the graphs for individual domains. This makes it very hard to see any changes as they look all values are Zero.  Is there any way to hide "Visists" from the graph in order to zoom in on the vertical axis? How to create a table with merged columns and rows, and wrapped text, like in MS Word? Live in Florida & work remote for a New York company. Do I owe NY state income tax? I have been down in Florida for the past 3 1/2 years and continue to pay New York state taxes out of the money I earn for a company I work remote for that is in New York.  Should I be paying New York state taxes on this income?  Or do I not need to pay New York state tax because I live in Florida?  Our NY accountant says I need to continue to pay since company is out of NY, however others say I don't need to pay.  Pls advise which is correct. Thank you. Sort Order on the User Filter is Surprising To Me When filling in the "Type to Find Users" , it seems to sort by exact match and then by reputation when I am on the reputation tab.   For example, please consider the following search results:    This threw me off since I thought that the sort order is reputation. I guess this often might give people what they want, but when picking a popular name is shows a lot of 0 rep users. Maybe adding a filter for low rep to the exact match might give more expected results, or just sorting on Rep? monitor files (à la tail -f) in an entire directory (even new ones) I normally  watch many logs in a directory doing tail -f directory/*. The problem is that a new log is created after that, it will not show in the screen (because * was expanded already).  Is there a way to monitor every file in a directory, even those that are created after the process has started? Google search results showing up a URL on its search which doesn't exist on the website Graphics issues after/while installing Ubuntu 16.04/16.10 with NVIDIA graphics I installed or upgraded to Ubuntu 16.04, but I'm having some problems with my graphics card.   The display is blank The display flickers Items on the screen do not display correctly Certain programs complain of graphics issues The computer boots to low-graphics mode Your specific issue may not be here, but try the solutions described in the answers anyway.   This question is very broad, but each one of these issues likely has one solution.    If you are experiencing a login loop, check the last part of my answer.    If you experience one of the listed issues and have your own solution (mine didn't work, or there's a faster way), feel free to post another POLITE answer, describing your problem and how you fixed it.    Those attempting to install Ubuntu, please refer to the section titled: If you are unable to enter a TTY or are trying to install Ubuntu. Check if file is already open How to change the monitor's refresh rate? How do I change the monitor's refresh rate in Oneiric?   There is no option to do it in the Displays dialog now. By default it's 60Hz, but I need 75Hz on my monitor.  In previous releases there used to be such an option in the Displays dialog.  Edit - Half baked solution  The best I could do so far was:  xrandr -s 1280x1024 -r 75   This is perfect, but my problem is that it isn't permanent. It defaults back to 60 Hz after logging out and back in.  Perhaps this should go into some script and added to startup? I just don't know how to do that. Let $f$ and $g$ be entire functions such that $f^n+g^n=1$, where $n\geq 3$ is an integer. Prove that $f$ and $g$ are constant.  I suppose I should somehow prove that either $f$ or $g$ is bounded so that I can apply Liouville's Theorem, but I don't see how. I tried setting the derivative of the left hand side equal to zero and work with that but that did not seem to work. Show some indication that account is banned from asking new questions How to retrieve GET parameters from JavaScript Is there a standard delay for consumer ratings of apps on the App Store? I have an app that's been out for a couple of weeks. Its not exactly selling like hot cakes yet, but I'm pretty sure I've gotten a rating or a review by now. But nothing shows when viewing either in iTunes or directly on the AppStore on the iPhone.  Is there a standard delay as to when ratings/reviews show up, that Apple imposes, especially for new apps? Or do you think there is some problem with Apple's system? I would like someone to explain me how the sense of a sentence changes with using "for me" or "to me":  Some examples:     1a.  She is a good friend to me.   1b.  She is a good friend for me.        2a.  How special you are to me.   2b.  How special you are for me.        3a.  It's an interesting topic to me.   3b.  It's an interesting topic for me. Format string dynamically How do I convert a SMP server world into a Single-player compatable world? I had a Minecraft world on Minefold.  I archived my Minecraft world just before Minefold closed about a year ago.  I'm trying now to open the world in my local Minecraft installation on OS X, but it doesn't show up in the worlds list.  To import it, I simply unzipped the archive from Minefold into my ~/Library/Application Support/minecraft/saves folder.  I'm running Minecraft 1.8, and I don't have any mods installed.  There's no error; the world just doesn't show up in my list of worlds after I click [Singleplayer] (or [Multiplayer]).  Now, the big clue is that the directory structures are different between my locally-created worlds and the world created on Minefold, but I can't figure out how to adapt the files to make them match:  This is a screenshot of my saves folder. I've circled in blue "local" and "minefold", which contain data files for the local and Minefold worlds, respectively.    I bracketed similar filenames in both worlds, but I'm flummoxed in that the Minefold version has three (3) sets of data files, whereas the local world has only one (1) set of files (even though I have visited Nether in the local world).  How do I load my old Minefold world locally?