My understanding is that the Air Force is sort of consolidating its fleet and the F-22 Raptor and the F-35 Lightning-II are both replacements for a large number of aircraft, including but not limited to:
A-6
F-14
F-15
F/A-18
F-16
F-117
All of these planes sort of grew out of the Aerospace boom post WWII, but maintaining so many different aircraft gets expensive.
If I understand correctly, there's no direct mapping between each replaced aircraft and the F-22 or the F-35, despite what unreliable sources like Wikipedia have written about the aircraft. The real issue is basically cost cutting, reducing:
1. Spares Costs
2. Supply Chain Costs
3. Training Costs
4. Number of Pilots in Air
Each plane overlaps the other somewhat and is unique in other ways. For example , the F-35 is designed as a cheap exportable aircraft, while the F-22 is designed for US-only operation. The F-22 is designed to go places very quickly and without being noticed, most of the money is in making it go faster than any other plane and be less vulnerable than any other plane to radar weapons. Both tasks are very expensive to execute.
The F-35 has comparatively cheaper, but more flashy tech, such as the HMDS:
Which is designed to allow the gunner to basically "see through" the aircraft, moving towards reducing the burden of combining the (traditionally separate) gunner and pilot. One variant of the JSF airframe also has VTOL capability as was displayed in the latest "Die Hard" movie.
I'm hoping that other people can chime in and share more.