I've this code where two lists are compared on the &quot;vendor_id&quot; field and I perform join on them. However this line is throwing NPE. I tried guarding with null but it doesn't seem to help. public List&lt;PGRatingResponse&gt; collatePGRatingsbyVendor(List&lt;PGRatingConfig&gt; pgRatingSansPgname, List&lt;Vendor&gt; vendors) {     return                 pgRatingSansPgname.stream().map(o1 -&gt; {                     vendors.stream()                             .filter(o2 -&gt; o2.getVendorId().equals(o1.getVendorId()))                             .findAny();                      return new PGRatingResponse(                         o1.getVendorId(),                          vendors.stream()                             .filter(o -&gt;                                 o.getVendorId().equals(o1.getVendorId())                                 &amp;&amp; o.getVendorId()!=null)                             .findFirst()                             .get()                             .getVendorName(),                          o1.getRating()                            .stream().map(o -&gt;                                 new RatingResponse(                                    pgLookupTable().getOrDefault(                                       o.getPgId()==null?&quot;&quot;:o.getPgId(),                                        &quot;Default&quot;),                                     o.getPgId()==null?&quot;&quot;:o.getPgId(),                                     o.getValue()))                            .collect(Collectors.toList()));                  }).collect(Collectors.toList()); }  The inner return statement in the lambda expression is the line number where the stack trace points to. I'm still getting this exception: java.lang.NullPointerException] with error Id, error code and message [[com.service.configuration.PGRatingConfigService.lambda$collatePGRatingsbyVendor$2(PGRatingConfigService.java:50),java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195), java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655), java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484), java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474), java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913), java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234), java.base even when I made changes to this line: return new PGRatingResponse(o1.getVendorId(), &quot;Default&quot;,/*vendors.stream().filter(o -&gt; o.getVendorId()!=null &amp;&amp; o.getVendorId().equals(o1.getVendorId())).findFirst().get().getVendorName(),*/ o1.getRating().stream().map(o -&gt; new RatingResponse(pgLookupTable().getOrDefault(o.getPgId()==null?&quot;&quot;:o.getPgId(), &quot;Default&quot;), o.getPgId()==null?&quot;&quot;:o.getPgId(), o.getValue()==null?0.0:o.getValue())).collect(Collectors.toList()));
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
What is a single word in English which means to look down on others (due to their younger age, lower socio-economic position, lesser experience, etc)    Not look down upon everyone else in general, but look down upon some particular person due to a feeling of superiority of oneself over them ( this superiority may come from the fact that one feels has more money, talent, etc)?    By "look down upon" I don't mean just the feeling of having superiority over another, but acting to them in a manner that reflects this pride as well (for example, perhaps he acts very rudely to them, since he feels superior to them and feels he can get away with it, or he feels it doesn't matter at all due to his superiority) Let $A$ and $B$ be $n\times n$ matrices such that $ABAB=0_{n\times n}$.  Can we conclude that  $BABA$ must be  $0_{n\times n}$?   I fail to give a counterexample when $n=2$， so I guess the answer is "yes" Can I travel to Canada with valid visa on old/expired passport? I recently renewed my passport. I also have an expired passport which has my Canada visa (visitor's) valid for another three years. I have already used my Canadian visa which is multiple entry. I am planning to visit Canada this summer.  Since my valid Canadian visa is in my old/expired passport, do I need to renew/transfer my Canada visa or can I simply travel with valid visa in old passport? Let $f$ be an entire function with $|f(z)|\le 100\log|z|,\forall |z|\ge 2,f(i)=2i, \text{ Then} f(1)=?$  I have no idea how to solve this one!  $g(z)={f(z)\over \log|z|}$ Then Can I say $g$ is constant by Liouville Theorem? iPhone 4 passcode lock disabled and no access to iTunes No Dialect mapping for JDBC type: -9 with Hibernate 4 and SQL Server 2012 I have a StreamReader object that I initialized with a stream, now I want to save this stream to disk (the stream may be a .gif or .jpg or .pdf).  Existing Code:  StreamReader sr = new StreamReader(myOtherObject.InputStream);    I need to save this to disk (I have the filename). In the future I may want to store this to SQL Server.   I have the encoding type also, which I will need if I store it to SQL Server, correct? Convince grep to output all lines, not just those with matches How do I make money efficiently? In Oblivion, I had two favorite money-makers:   Dump all my stuff except some basic armor and potions, and raid an oblivion tower. The armor and weapons was worth lots, and selling it in Anvil made a lot of cash fast. Harvest an entire farm's worth of crops, create 'restore fatigue' potions and sell them.   Skyrim seems to spoil this:   Merchants have a max-amount per day/QOD/... instead of per item You can't carry as much (or maybe I have yet to discover the strength/feather spells) Alchemy is a lot harder (most common items go into food recipes now, which don't sell for those prices) On top of that, once a dungeon is cleared, it doesn't respawn - so no 'farming' familiar dungeons?   What are some easy/repeatable money making methods in Skyrim? Which are most efficient effortwise/real-life-time wise? Concrete Mathematics - The Josephus Problem I've been going through  and have a question on the inductive proof for the . Recurrent relation:  $J(1) = 1$ $J(2n) = 2J(n) - 1$ $J(2n+1) = 2J(n) + 1$  Closed form hypothesis:  $J(2^m + l) = 2l + 1$, for $m \ge 0$ and $0\le l&lt;2^m$  Inductive Proof (for the even case):  $J(1)=1$ $J(2^m+l)= 2J(2^{m-1}+l/2)-1=2(2l/2+1)-1=2l+1$  How do the authors get from $2J(2^{m-1}+l/2)-1$ to $2(2l/2+1)-1$? Do opposite categories always exist? This morning I upgraded my system to Windows 10 2004, the upgrade went smooth and was through Windows Update. I am using Hyper-V as my virtualization program for virtual machines and to provide extra layer of protection to the system through core isolation. After the upgrade, I noticed that a new Virtual Switch was created with the name &quot;vEthernet (Ethernet)&quot; where &quot;Ethernet&quot; within the parentheses is the name of my primary network adapter. Also noticed this behavior has a specific pattern of creating new vSwitches correspond to the adapters you have, e.g. if you created a new Virtual Switch and restarted the system, a new additional switch will appear with the name &quot;vEthernet (your-new-switch-name)&quot;. Tried to remove Hyper-V and reinstall it but no luck. I am aware of a similar  on SuperUser but has no answers on it. Any clues for the root of the problem? How to prevent my screens from turning off, when the screen is locked? I would like to have my screen fully powered at all times, but it goes to standby once I lock my PC. When I have a query that checks if a column of type uniqueidentifer does not exist in a table that has a null value then I get no results back. If the subquery does not return a null it works fine and it only happens when using not in.   I know I can just do a not null check in my subquery, but I am curious why this does not work.  Query Example:  select a.guid from tableA a where a.guid not in (select b.guid from tableB AS b)   Working Test:  select 1 where newid() not in (select newid())   Broken Test:  select 1 where newid() not in (select null) Warning or confirmation on new tag creation In retrospect of this , I would like to ask the community how they feel about a warning or confirmation (or just special highlighting) on new tag creation.  Everybody hates stock "are you sure?" confirmation, but a lot of tags get created by mistake (and then used ad nauseam).   For example, I think I might have created the  tag by accident. Assuming the right tag was , there would be two tags for c# 4.0, until they are made synonyms. With a warning, some accidental tags could be prevented. By default  indents with a hard tab character. How do I change it to spaces? Story where someone gets disconnected from computers for cybercrime I read a short (in the range of 5-20 pages) science fiction story a while ago, and can't remember the title of the story or its author at the moment.  The basic story is that of a super-savvy computer hacker who got all of his knowledge of computers removed from his brain, temporarily (one year?) for cybercrime, including (IIRC) some form of identity theft, and is released into the public without any jail-time or anything. This is very hard on him, for this future-Earth relies heavily on highly interconnected computers for basic and daily needs. This is not immediately clear at the start of the story, but it becomes apparent after a little while.  Part of the story includes the main character (I don't remember if he is granted a name in the story) wanders into a cafe or a bar, and is invited to play a game of digital, . He has to turn down the invite, though, because he doesn't know and is blocked from knowing how to use computers. He also really doesn't want the other characters to know this, because apparently having your computer knowledge removed from your brain for cybercrime is a major stigma in that society. The character also has difficulty using his (futuristic equivalent of a) credit card, as that also requires some computer knowledge.  Any ideas? Squares in arithmetic progression It is easy to find 3 squares (of integers) in arithmetic progression. For example, $1^2,5^2,7^2$.  I've been told Fermat proved that there are no progressions of length 4 in the squares. Do you know of a proof of this result?   (Additionally, are there similar results for cubes, 4th powers, etc? If so, what would be a good reference for this type of material?)    Edit, March 30, 2012: The following  in MO is related and may be useful to people interested in the question I posted here. PostgreSQL Shapefile import failed I am very new to PostGIS/PostgreSQL. In fact, I downloaded it because of the answers I got to this question:   I installed both PostgreSQL and PostGIS. But I am not able to import a shapefile to the database? It gives an error, "Shapefile import failed". What am I doing wrong? Do Stack Exchange sites allow editing of comments and posts from other users? Possible Duplicate:         Is this normal behavior in Stack Exchange sites that after just signing up one can edit not only his/her own comments / posts, but also others' comments / posts?  If so, then the Q&amp;A does not look safe to me. Imagine someone maliciously modifying a post and bringing bad reputation on a Q&amp;A member.  Can you check this and perhaps fix it?