Having your idea stolen may not be so bad either. The usual analogy is the 2nd mouse getting the cheese.
An earlier competitor can open up a market for you to swoop into and grab, if your product is better or better marketed.
Of course a canny mouse might grab the cheese and leave the trap set for you to die on, don't trust dodgy business analogies too much.
A quick story about a little business - it's a pottery painting studio http://www.barefoot-ceramics.co.uk , we were hesitant about opening here because we saw the potential market to be possibly too small; pottery painting as a concept had not been established in the UK at the time. When we were preparing to open we were very secretive as we felt without first-move advantage or in the presence of competition we'd collapse. Another studio opened in the month before us whilst we were preparing the premises. They however closed 6 months later and, as we'd established a relationship with them, passed us on some customers and bookings. They also helped to establish the idea in the local area and probably in the long run we've had a small financial benefit from that time.
We've since suffered from customers who have (contrary to promises) established similar businesses locally by using our studio and then mimicing us. They liked what we were doing so much they thought they'd try and put us out of business, nice! You can't really do much about that sort of thing though.