The main thematic similarity in these books--which have very different kinds of themes, such as war versus idealized nature--are those of alienation and loneliness in Salinger's The Catcher in the Rye and isolation and identity in Hemingway's A Farewell to Arms. In Hemingways' story, Frederick struggle with the isolation war imposes and with holding onto his identity, which he merges with Catherine's. On a deeper level, Hemingway is also exploring the identity of humankind after the vast death and destruction caused by World War I.
In Salinger's story, Holden struggles for a satisfying and plausible identity in a world marked for him by grief--he is ever grieving for Allie--and falseness; he even decides Mr. Antolini is false prompting him to flee the sanctuary he had found there:
"I have to go away," I said--boy, was I nervous! I started putting on my ... pants in the dark. I could hardly get them on I was so ... nervous.
Since he can not find his true--and stable--identity in a world full of things he dislikes, as Phoebe tells him, or even hates, as Antolini tells him, he has a growing sense of personal and social isolation: he is isolated from personal relationships and isolated from social interaction in a society for which he has neither respect nor trust, but from which he hopes to save the innocent next generation, like the catcher in the rye in his dream:
That's all I'd do all day. I'd just be the catcher in the rye