For sure, you can substitute walnuts for the same amount of pecans. I have made this cake using walnuts, but the pecans have a sweeter taste and slightly softer texture, which is why they are my personal favorite for this blueberry cake.